[新手求助]右击创建动态菜单问题
我想在窗口中在右击鼠标的时候弹出动态菜单,但是我按照书上的写了,却会报错,那个高手能帮忙解释一些,谢谢!代码:
void CExeView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMenu menu1;
menu1.CreatePopupMenu();
menu1.AppendMenu(0,111,"command1");
menu1.AppendMenu(0,112,"command2");
CPoint pt;
GetCursorPos(&pt);
menu1.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
menu1.DestroyMenu();
CView::OnRButtonDown(nFlags, point);
}