[Solved] OnMessage(WM_INITPOPUPMENU) doesn't work
Posted: 08 Jun 2016, 07:26
Hi,
I want to enable/disable some items before a menu is about to be shown.
I know how to do this in a classic Win32 application: Process the WM_INITPOPUPMENU message.
This works in my C++ application.
But when I set a message handler for WM_INITMENUPOPUP using OnMessage() in an AHK script, it seems not work.
Here is my test script:
When I right click the mouse button, "mymenu" is shown, but "listvars" is never called, neither "MsgBox" is called if I change "listvars" to "msgbox".
I am using the currently latest version: v1.1.24.00
Any help please?
I want to enable/disable some items before a menu is about to be shown.
I know how to do this in a classic Win32 application: Process the WM_INITPOPUPMENU message.
This works in my C++ application.
But when I set a message handler for WM_INITMENUPOPUP using OnMessage() in an AHK script, it seems not work.
Here is my test script:
Code: Select all
#NoEnv
WM_INITMENUPOPUP(wParam, lParam, msg, hwnd) {
listvars
}
WM_CONTEXTMENU(wParam, lParam, msg, hwnd) {
Menu, mymenu, Show
}
Menu, mymenu, Add, exit1, GuiClose
Menu, mymenu, Add, exit2, GuiClose
Gui, Show, w400 h300, Title
OnMessage(0x117, "WM_INITMENUPOPUP")
OnMessage(0x7B, "WM_CONTEXTMENU")
return
GuiClose:
GuiEscape:
ExitApp
I am using the currently latest version: v1.1.24.00
Any help please?