怎样添加右键菜单? 就是在程序窗口单击右键响应一个菜单..... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 添加一个菜单资源,初始化时LoadMenu,在窗口类中保存菜单句柄,响应WM_RBUTTONUP消息,调用TrackPopupMenu函数显示菜单。 来个更简单的,,VC6.0菜单:Project\Add To Project\Components and Controls...在Visual C++ Components文件夹下选择Pop-up Menu插入,然后选择插入的地方就可以了具体做法如LS:但会自动添加一个菜单资源,调用TrackPopupMenu函数显示菜单。如在CXXXView类中:void CTestMuView::OnContextMenu(CWnd*, CPoint point){ // CG: This block was added by the Pop-up Menu component { if (point.x == -1 && point.y == -1){ //keystroke invocation CRect rect; GetClientRect(rect); ClientToScreen(rect); point = rect.TopLeft(); point.Offset(5, 5); } CMenu menu; VERIFY(menu.LoadMenu(CG_IDR_POPUP_TEST_MU_VIEW)); CMenu* pPopup = menu.GetSubMenu(0); ASSERT(pPopup != NULL); CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD) pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); }}(c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Gallery\Visual C++ Components\Pop-up Menu) …………在你项目的资源视图里,点××.rc,右键,添加资源,看到menu没,想加啥加啥 打开ResourceView,,Menu中多出一个,,然后你修改增加就行,也可把你原来的菜单项放到这里,这是插入Pop-up Menu才会出现的,你自己添加也是一样的. Devang说的做法好简单,赞!感谢三位! 欢迎大家提供文章信息! Debug状态下程序运行完好,Release状态下运行出错! 哪里有Cjlibrary的使用说明? 佛祖说出的爱情箴言 我不会了,请大家有空看一眼,出出主意,谢谢? 如何用USBKEY加密电子邮件呢,对这个问题我一点思路都没有,请大家参与。 交互式绘图程序MFC实现平移缩放等功能,不用openGL 大虾指点下我的这段代码有什么问题,关于excel,new,delete ATL 里面能不能用MFC的类库 怎样将CString转换为int型?(新手) MFC消息入门甚艰,可有简单实例效仿一二?? 如何给数值型变量输入一个NULL值?
void CTestMuView::OnContextMenu(CWnd*, CPoint point)
{ // CG: This block was added by the Pop-up Menu component
{
if (point.x == -1 && point.y == -1){
//keystroke invocation
CRect rect;
GetClientRect(rect);
ClientToScreen(rect); point = rect.TopLeft();
point.Offset(5, 5);
} CMenu menu;
VERIFY(menu.LoadMenu(CG_IDR_POPUP_TEST_MU_VIEW)); CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
pWndPopupOwner);
}
}(c:\Program Files\Microsoft Visual Studio\Common\MSDev98\
Gallery\Visual C++ Components\Pop-up Menu)