偶在mdi窗口中用setmenu(null)结果那个该死的菜单还在。怎么去掉主菜单?

tzgh2000 2001-09-13 03:45:41
...全文
299 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
beni 2001-09-14
  • 打赏
  • 举报
回复
MDI创建子窗口的时候必须有menu才行
ray2_ls 2001-09-14
  • 打赏
  • 举报
回复
up
蒋晟 2001-09-14
  • 打赏
  • 举报
回复
BOOL CModalFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
if(cs.hMenu!=NULL)
{
::DestroyMenu(cs.hMenu); // delete menu if loaded
cs.hMenu = NULL; // no menu for this window
}
}
tzgh2000 2001-09-13
  • 打赏
  • 举报
回复
to: gainlsy1:
不行没有效果!我用的MDI程序。htmlview。win2000下。vc6没有成功
to 111222:
谢谢!。看了bcgcbcontrolbar的代码和cjlib的。它们都 用的setmenu(好象
前者用了hook等 好多东东。好麻烦。我做的那个menubar只有main的,没有子窗口
的。NND,就是那个菜单怎么都NULL不掉!

谢谢大家。等 下加分。
111222 2001-09-13
  • 打赏
  • 举报
回复
这个SetMenu(NULL); 要把握好时机,要等菜单创建以后
InitInstance的话,要在
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
....

之后。

在OnCreate的话,主窗口一创建NULL掉菜单就可以
-----------------
我在你问怎么做IE那样菜单的帖子里贴了一个MenuBar的url
gainlsy1 2001-09-13
  • 打赏
  • 举报
回复
在CMainFrame中的OnCreate return 0之前加上this->SetMenu(NULL)就可以了,我刚试过的
,没有问题
luckyegg 2001-09-13
  • 打赏
  • 举报
回复
关注。
tzgh2000 2001-09-13
  • 打赏
  • 举报
回复
那么IE的那种toolbar式的菜单是怎么做出来的?
san_huo 2001-09-13
  • 打赏
  • 举报
回复
在App类的InitInstance中加一句
pMainFrame->SetMenu(NULL);
beni 2001-09-13
  • 打赏
  • 举报
回复
你是说缺省的那个“File。。。”的菜单要彻底干掉?
不行的
你看看MFC创建子窗口的函数就知道了:

BOOL CMDIFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*)
{
CMenu* pMenu = NULL;
if (m_hMenuDefault == NULL)
{
// default implementation for MFC V1 backward compatibility
pMenu = GetMenu();
ASSERT(pMenu != NULL);
// This is attempting to guess which sub-menu is the Window menu.
// The Windows user interface guidelines say that the right-most
// menu on the menu bar should be Help and Window should be one
// to the left of that.
int iMenu = pMenu->GetMenuItemCount() - 2;

// If this assertion fails, your menu bar does not follow the guidelines
// so you will have to override this function and call CreateClient
// appropriately or use the MFC V2 MDI functionality.
ASSERT(iMenu >= 0);
pMenu = pMenu->GetSubMenu(iMenu);
ASSERT(pMenu != NULL);
}

return CreateClient(lpcs, pMenu);
}

sam1111 2001-09-13
  • 打赏
  • 举报
回复
DeleteMenu
tzgh2000 2001-09-13
  • 打赏
  • 举报
回复
不行啊,老大,出错了。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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