[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

Hiding menu bar in a FrameWnd

How can I get the menu bar to disappear during one view and get it to appear again in another view without deleting it and reloading it ?
0
Trilobite
Asked:
Trilobite
1 Solution
 
plarocheCommented:
Is it a menubar or the menu of the application?

Menubar: à docking menu like in Visual Studio
0
 
ZoppoCommented:
Somehow like this:

HMENU savedHandle = NULL;

void HideMenu(CWnd *wnd)
{
  CMenu menu = wnd->GetMenu();
  if ( NULL != menu )
  {
    savedHandle = menu->GetSafeHmenu();
    wnd->SetMenu( NULL );
  }
}

void ShowMenu( CWnd *wnd )
{
  if ( NULL != savedHandle )
  {
    CMenu *menu = CMenu::FromHandle( savedHandle );
    wnd->SetMenu( menu );
    savedHandle = NULL;
  }
}

now you can call this i.e. in any CMainFrame message handler by calling
CMainFrame::AnyFunction()
{
.
HideMenu( this );
.
ShowMenu( this );
.
}

hope that helps,

ZOPPO
0
 
TrilobiteAuthor Commented:
Thanks a lot.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now