Solved

Hiding menu bar in a FrameWnd

Posted on 1998-12-15
3
305 Views
Last Modified: 2013-11-20
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
Comment
Question by:Trilobite
3 Comments
 
LVL 3

Expert Comment

by:plaroche
ID: 1326215
Is it a menubar or the menu of the application?

Menubar: à docking menu like in Visual Studio
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 100 total points
ID: 1326216
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
 

Author Comment

by:Trilobite
ID: 1326217
Thanks a lot.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question