Hi!
I want to hide a standard main menu toolbar of my MFC doc/view application. Howto?
I tried this
- no reactionCode:ShowControlBar(&m_wndToolBar,TRUE,FALSE);
thanks in advance.
Printable View
Hi!
I want to hide a standard main menu toolbar of my MFC doc/view application. Howto?
I tried this
- no reactionCode:ShowControlBar(&m_wndToolBar,TRUE,FALSE);
thanks in advance.
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
Solved:
Code:void CMainFrame::Hide()
{
this->SetMenu(NULL);
}
void CMainFrame::Revoke()
{
CMenu m_NewMenu;
m_NewMenu.LoadMenu(IDR_MAINFRAME);
this->SetMenu(&m_NewMenu);
}
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
Oh, thanks for this note! I've read msdn. How could I be so inattentive?..(