MDI中不显示菜单

在MDI窗口中取消主菜单以及子框架窗口的显示,解决方法来源于网上,步骤如下:

(1)删除子框架菜单IDR_XXXTYPE,为了保险,此步似乎可省略(无测试).

注意:不能删除主框架菜单IDR_MAINFRAME,否则出错.

(2)重载PreCreateWindow函数

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if( !CMDIFrameWnd::PreCreateWindow(cs) )
  return FALSE;
 // TODO: Modify the Window class or styles here by modifying
 //  the CREATESTRUCT cs
 if(cs.hMenu!=NULL)
 {
  DestroyMenu(cs.hMenu);
  cs.hMenu=NULL;
 }
 return TRUE;
}

(3)重载LoadFrame函数,注意与原函数的差别:CMDIFrameWnd---->CFrameWnd

BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle , CWnd* pParentWnd , CCreateContext* pContext)
{
 // TODO: Add your specialized code here and/or call the base class

 return CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);
}

(4)重载OnCreateClient函数,注意与原函数的差别:OnCreateClient(lpcs,pContext)---->CreateClient(lpcs,NULL)

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
 // TODO: Add your specialized code here and/or call the base class

 return CreateClient(lpcs, NULL);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值