I found an interesting code here (http://www.visual-basic.com.ar/vbsmart/library/smartmenuxp/smartmenuxp.htm) claiming that it is possible to subclass menus by hooking their creating in the main window's WM_CREATE handler.
The hook works, technically speaking, but the menu windows handle does not show up :(
invoke GetCurrentThreadId ; shorter than GetWindowThreadProcessId, hWnd, 0
invoke SetWindowsHookEx, WH_CALLWNDPROC, CbMenu, 0, eax
Any ideas? The attachment has a useMB switch on top - set to 0 if you want to stick with QEditor. There is a cdt_MB.exe in the attachment showing what the deb 4 macro does. Sample output:
ResHook eax 140248117
CREATE
hMenu 197592281
wMenu 65562
posc
[ebx.WINDOWPOS.lx] 400
[ebx.WINDOWPOS.cy] 350
Class $edi ToolbarWindow32
No luck
ecx 4786962
hMainWindow 0
wMenu 65562
hMenu 197592281
Class $edi MSCTFIME UI
No luck
ecx 4983554
hMainWindow 0
wMenu 65562
hMenu 197592281
Class $edi CicMarshalWndClass
No luck
ecx 4131644
hMainWindow 0
wMenu 65562
hMenu 197592281
posc
[ebx.WINDOWPOS.lx] 400
[ebx.WINDOWPOS.cy] 350
the only possibility that pops into mind is that the menu's window handle may not be the same as the menu handle :P
the OS treats window handles differently than menu handles
the caption bar seems to be the same way
if you enumerate windows using the menu handle, you may not get it
have you looked at the source code for xxControls ?
Quote from: dedndave on November 24, 2011, 12:19:50 AM
the only possibility that pops into mind is that the menu's window handle may not be the same as the menu handle :P
indeed. hMenu is the menu handle, wMenu is the menu's window handle obtained with FindWindow.