Xavier > 2025-01-12 19:36
Menu_SetModeless("dtmenu") ; make menu modeless
Menu_SetModeless("insert") ; make menu modeless
;; etc
;; etc
;; etc for each menu
return ;; first return, end autoexe
; source: https://www.reddit.com/r/AutoHotkey/comments/193wdki/hotkeys_are_dont_work_when_a_menu_is_being_shown/
; This function self initializes. No need to call it manually.
; When the user clicks away to close the menu, the message WM_ACTIVATEAPP is sent.
; Calling EndMenu on WM_ACTIVATEAPP fixes the bug that causes a modeless menu to show in the previous position.
; this function allows hotkeys to be triggred when a menu is visiable, usually ahk blocks hotkeys when its busy displaying a menu.
ModelessMenuEnd(wParam) {
static _ := OnMessage(0x0000001C, "ModelessMenuEnd") ; WM_ACTIVATEAPP
if !wParam
DllCall("EndMenu")
}
Menu_SetModeless(menuNameOrHandle)
{
if menuNameOrHandle is Not Integer
hMenu := MenuGetHandle(menuNameOrHandle)
else
hMenu := menuNameOrHandle
if !hMenu
return
size := 16+3*A_PtrSize
VarSetCapacity(MenuInfo, size, 0)
NumPut(size, MenuInfo, 0) ;cbsize
MIM_STYLE := 0x10
MNS_MODELESS := 0x40000000
NumPut(MIM_STYLE, MenuInfo, 4) ;fmask
DllCall("GetMenuInfo", "ptr", hMenu, "ptr", &MenuInfo)
style := NumGet(MenuInfo, 8, "uint") ; check dwStyle
if !(style & MNS_MODELESS) ; If dwStyle not modeless
{
; Set MNS_MODELESS style
NumPut(style|MNS_MODELESS, MenuInfo, 8)
DllCall("SetMenuInfo", "uint", hMenu, "uint", &MenuInfo)
}
}
Jean Lalonde > 2025-01-13 08:05
Jean Lalonde > 2025-01-19 12:31