鼠标右键菜单

 1、创建菜单资源IDR_MENU1;
2、在对话框映射WM_RBUTTONUP消息;
3、WM_RBUTTONUP消息处理函数:

void CTestDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 CMenu menu;
 DWORD dwPos = GetMessagePos();
 CPoint point1( LOWORD(dwPos), HIWORD(dwPos) );

 menu.LoadMenu( IDR_MENU1 );
 CMenu* popup = menu.GetSubMenu(0);
 ASSERT( popup != NULL );
 popup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point1.x, point1.y, this);

 CDialog::OnRButtonUp(nFlags, point);
}

4、ListControl右键菜单:
 基本跟对话框一样,映射ListControl的NM_RCLICK消息。

你可能感兴趣的:(鼠标右键菜单)