Solved

Hiding menu bar in a FrameWnd

Posted on 1998-12-15
3
301 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 30

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mac OS 9 (Classic Environment) vs. MacBook Pro OS 10 8 37
haveThree challenge 22 101
MaxSpan challenge 9 67
Path of Workbook 3 45
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now