Handling a right click on a menu item
I am triggering off the WM_CONTEXTMENU message to handle a shortcut menu. It calls TrackPopupMenuEx to display the menu and track selections. However, there appears no way to tell that function to handle right click selection of menu options. Left click selections work fine.
I cannot find anywhere in the Win32 documentation how I can do this. Is there a simpler way than: on a right click, see if they clicked on an item on the menu using Hit Test?
Thanks, Alan
[537 byte] By [
Inspired] at [2007-11-18 19:17:59]

# 1 Re: Handling a right click on a menu item
Then you didn't look hard enough ;)
See the TPM_RIGHTBUTTON flag in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuFunctions/TrackPopupMenuEx.asp
Marc G at 2007-11-9 13:09:58 >

# 2 Re: Handling a right click on a menu item
For anyone who might not know: TPM_RIGHTBUTTON and others are shown in Win32 Help files under CreateWindow but not CreateWindowEx (latter says to look at the former for others). In general, I have found that the Help for the ...Ex functions say to look at the "old" (...) function for other parameter values.
# 3 Re: Handling a right click on a menu item
Marc G is correct. Just specify TPM_RIGHTBUTTON with the fuFlags parameter on TrackMenuPopup[Ex]. That would allow the user to use both the right and left mouse buttons to select a menu item.