界面添加WM_CONTEXTMENU消息
void CIPS4410View::OnContextMenu(CWnd* pWnd, CPoint point)
{
// TODO: Add your message handler code here
CMenu popMenu;
popMenu.LoadMenu(IDR_MENU_TOOL);
POINT CurPos;
GetCursorPos(&CurPos);
CMenu *pMenu = popMenu.GetSubMenu(0);
pMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,CurPos.x,CurPos.y,this);
return;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
//cs.style &= ~(WS_SYSMENU); //加上这句即可隐藏右上角最大化最小化关闭按钮
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.hMenu = NULL;//加上这句即可隐藏菜单栏
return TRUE;
}