Solved

Hiding menu bar in a FrameWnd

Posted on 1998-12-15
3
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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