DeleteMenu主菜单返回成功,但还是显示

Jony07 2014-08-04 05:24:17
代码如下:返回值b、b1都是true,b2为false;b1和b2是删除同一个项的,也试过了RemoveMenu,也是一样的效果。在vs2008写的,对C++不是很熟悉,请各位大虾帮忙看看。


BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
// 基类将执行真正的工作
CMenu menu;
menu.Attach(m_wndMenuBar.GetHMenu());
if(menu != NULL)
{
bool b,b1,b2;
b = menu.GetSubMenu(0)->DeleteMenu(0, MF_BYPOSITION);
b1 = menu.GetSubMenu(0)->DeleteMenu(ID_UESR_LAYER_LIST,MF_BYCOMMAND);
b2 = menu.GetSubMenu(0)->DeleteMenu(ID_ADD_NEW_ROUTE,MF_BYCOMMAND);
DrawMenuBar();
}

return TRUE;
}
...全文
66 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-08-04
  • 打赏
  • 举报
回复
CWnd::SetMenu BOOL SetMenu( CMenu* pMenu ); Return Value Nonzero if the menu is changed; otherwise 0. Parameters pMenu Identifies the new menu. If this parameter is NULL, the current menu is removed. Remarks Sets the current menu to the specified menu. Causes the window to be redrawn to reflect the menu change. SetMenu will not destroy a previous menu. An application should call the CMenu::DestroyMenu member function to accomplish this task. CWnd Overview | Class Members | Hierarchy Chart See Also CMenu::DestroyMenu, CMenu::LoadMenu,::SetMenu, CWnd::GetMenu

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧