Reputation: 65
I have:
CMenu menu;
CRect rc;
GetWindowRect(&rc);
VERIFY(menu.CreatePopupMenu());
menu.AppendMenu(MF_STRING, 0, _T("Cancella"));
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, point.x + rc.left, point.y + rc.top, this);
but I do't know how I can set ID menu.
Upvotes: 0
Views: 165
Reputation: 471
Do something like
#define ID_MYACTION 42
menu.AppendMenu(MF_STRING, ID_MYACTION, _T("Cancella"));
Then insert a message handler for this item like
// in your message map:
ON_COMMAND(ID_MYACTION, OnMyAction)
// the handler itself:
void CMyWnd::OnMyAction()
{
// do what you like
}
Upvotes: 1