在对话框中弹出右键菜单

 1 void C目录选择对话框Dlg::OnContextMenu(CWnd* pWnd, CPoint point)
 2 {
 3     CMenu menu, *pmenu = NULL;
 4     menu.LoadMenu(IDR_MENU1);
 5     pmenu = menu.GetSubMenu(0);
 6     //在弹出菜单之前进行禁用菜单项的操作
 7     pmenu->EnableMenuItem(ID_M_OPEN, MF_BYCOMMAND | MF_GRAYED);
 8     //进行弹出菜单操作
 9     pmenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
10 }

你可能感兴趣的:(在对话框中弹出右键菜单)