Detect context menu item was clicked in listview
Code:
HMENU hPopupMenu = CreatePopupMenu();
InsertMenu(hPopupMenu,
0,
MF_BYPOSITION | MF_STRING,
(UINT_PTR)hPopupMenu,
GlobalBuf2);
TrackPopupMenu(hPopupMenu,
TPM_BOTTOMALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON,
p.x,
p.y,
0, //Reserved; must be zero.
hDlg,
NULL); //Ignored.
I know that hDlg receives all messages from the menu.
But what kind of messages it gets?
I put a WM_LBUTTONDOWN case in WM_COMMAND but nothing happens when i click on the context menu.
Re: Detect context menu item was clicked in listview
Your hDlg receives WM_COMMAND message with the WPARAM set to Menu identifier (menu item ID).
See http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
Re: Detect context menu item was clicked in listview
Yes thank you Victor i found it. Its always easier after a good night sleep. :)
I had to create an identifier and set it as InsertMenu's four parameter.
And then check this identifier in WM_COMMAND.
Have a nice sunday!