regarding NM_RCLICK create popup menu

1
2
3
4
5
6
GetCursorPos(&p);
int iIndex = ListView_GetSelectionMark(hList);
hMenu = CreatePopupMenu();
InsertMenu( hMenu, 0, MF_BYPOSITION | MF_STRING, 0, "Hello");
SetForegroundWindow( hwnd );
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, p.x, p.y, 0, hwnd, 0);


hey guys so i already have made this popup menu, when right clicking an item from my listview

my problem now is, lets say when i clicked "Hello" menu, a messagebox will popup.
how do i create an event like that ?

thanks in advance
See:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms648002(v=vs.85).aspx

If you pass the TPM_RETURNCMD flag, the return value is the menu item selected, otherwise the function sends a WM_COMMAND message to the owner window.
thank you AHCFan20

int ret = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, p.x, p.y, 0, hwnd, 0);
Last edited on
Topic archived. No new replies allowed.