Created
August 13, 2017 14:04
-
-
Save tablacus/21f28d78acd7f3a944d52094d149fcd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FV = GetFolderView(Ctrl, pt); | |
if (FV) { | |
var hMenu = api.CreatePopupMenu(), hSubMenu; | |
var ContextMenu = FV.ViewMenu(); | |
if (ContextMenu) { | |
ContextMenu.QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_DEFAULTONLY); | |
var mii = api.Memory("MENUITEMINFO"); | |
mii.cbSize = mii.Size; | |
mii.fMask = MIIM_SUBMENU; | |
for (var i = 0; i < api.GetMenuItemCount(hMenu); i++) { | |
api.GetMenuItemInfo(hMenu, i, true, mii); | |
if (mii.hSubMenu) { | |
hSubMenu = mii.hSubMenu; | |
mii.fMask = MIIM_FTYPE | MIIM_STATE; | |
for (var j = 0; j < api.GetMenuItemCount(hSubMenu); j++) { | |
api.GetMenuItemInfo(hSubMenu, j, true, mii); | |
if (mii.fState & MFS_CHECKED && mii.fType & MFT_RADIOCHECK) { | |
mii.fMask = MIIM_ID; | |
if (j) { | |
api.GetMenuItemInfo(hSubMenu, j - 1, true, mii); | |
} else { | |
mii.fMask = MIIM_ID | MIIM_FTYPE; | |
for (var k = 0; k < api.GetMenuItemCount(hSubMenu); k++) { | |
api.GetMenuItemInfo(hSubMenu, k, true, mii); | |
if (mii.fType & MFT_SEPARATOR) { | |
mii.wID = wID; | |
break; | |
} | |
wID = mii.wID; | |
} | |
} | |
if (mii.wID > 0) { | |
ContextMenu.InvokeCommand(0, te.hwnd, mii.wID - 1, null, null, SW_SHOWNORMAL, 0, 0); | |
} | |
break; | |
} | |
} | |
break; | |
} | |
} | |
api.DestroyMenu(hMenu); | |
} | |
} |
Author
tablacus
commented
Aug 13, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment