用进程内钩子(不用dll的)
请修改我最近一个帖子中的hook代码
让他钩住WM_MENUSELECT事件在菜单弹出前开启钩子,钩住后发消息给窗口(用postmessage)
窗口再unlock钩子。如果菜单在一个窗口中,窗口类应该有该事件对应的方法。
请注意WM_MENUSELECT事件的文档
Remarks
If the fuFlags parameter contains 0xFFFF and the hmenu parameter
contains NULL, the system has closed the menu.
Do not use the value –1 for fuFlags. That is because fuFlags is
specified as (UINT) HIWORD(wParam). If HIWORD(wParam) were 0xFFFF,
fuFlags (because of the UINT cast) would be 0x0000FFFF, not –1.