简体   繁体   中英

how to know which menuitem is clicked using wh_getmessage hook?

i want to know which menuitem is clicked using WH_GETMESSAGE hook.can somebody help me please...from one week i stuck with this problem? plz provide a way how can we achive this..using win32 dll. i am working on vc++6.0.

Thanks in advance....

With WH_GETMESSAGE you can monitor any message.

When you catch WM_MENUSELECT you can examine the wParam to get the id/index.

from MSDN..

WM_MENUSELECT

wParam

The low-order word specifies the menu item or submenu index. If the selected item is a command item, this parameter contains the identifier of the menu item.

If the selected item opens a drop-down menu or submenu, this parameter contains the index of the drop-down menu or submenu in the main menu, and the lParam parameter contains the handle to the main (clicked) menu; use the GetSubMenu function to get the menu handle to the drop-down menu or submenu.

once you had the menu handle, you can always do GetMenuItemInfo / GetMenuItemID / GetMenuInfo etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM