|
-
May 23rd, 2012, 08:06 AM
#1
[RESOLVED] Control main menu toolbar
Hi!
I want to hide a standard main menu toolbar of my MFC doc/view application. Howto?
I tried this
Code:
ShowControlBar(&m_wndToolBar,TRUE,FALSE);
- no reaction
thanks in advance.
-
May 23rd, 2012, 10:05 AM
#2
Re: Control main menu toolbar
m_wndToolBar has nothing to do with a menu. It is a toolbar window.
In a "standard" MFC doc/view application menu bar is not a window, so you cannot just "hide" it. You could however destroy menu or destroy and then recreate it. See:
How to Use Multiple Menus in MFC App That Uses GetDefaultMenu
No replacement of Main menu bar
Victor Nijegorodov
-
May 24th, 2012, 02:14 AM
#3
Re: Control main menu toolbar
Solved:
Code:
void CMainFrame::Hide()
{
this->SetMenu(NULL);
}
void CMainFrame::Revoke()
{
CMenu m_NewMenu;
m_NewMenu.LoadMenu(IDR_MAINFRAME);
this->SetMenu(&m_NewMenu);
}
-
May 24th, 2012, 03:41 AM
#4
Re: Control main menu toolbar
 Originally Posted by 330xi
Solved:
Code:
void CMainFrame::Hide()
{
this->SetMenu(NULL);
}
...
This solution is very "dirty" because it produces the leak of menu handles.
You have to call CMenu::DestroyMenu to
accomplish this task cleanly.
See CWnd::SetMenu
Victor Nijegorodov
-
May 24th, 2012, 05:00 AM
#5
Re: Control main menu toolbar
Oh, thanks for this note! I've read msdn. How could I be so inattentive?..(
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|