Manually changing main menu in an MDI app |
Post Reply |
Author | |
JayW
Newbie Joined: 25 May 2005 Status: Offline Points: 11 |
Post Options
Thanks(0)
Posted: 23 June 2005 at 8:12am |
I have an application with several MDI-based editor windows (similar in appearance to Visual Studio/Dreamweaver, etc.), but it also has docking panes containing tree controls and properties which are not doc/view windows. Using the CMultiDocTemplate template class, I faithfully registered each editor document type with its own resources (menus, accelerator tables, etc.) and menus change properly when you switch back and forth between different editor views as expected. However, I cannot seem to manually load menus when, for example, a pane containing a tree view of the document hierarchy gets focus. I tried the following code but strangely, when I look at it in the debugger, m_hMenuDefault is always NULL when entering the function, which obviously will not work (it's hard to destroy a menu that doesn't exist...) void CMainFrame::SetMainMenu(UINT nIDResource) ASSERT(nIDResource); // Remove/destroy old menu // Add the requested menu SetMenu(&m_defaultMenu); } Thanks in advance, Jay |
|
JayW
Newbie Joined: 25 May 2005 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Well, I found a fix for MFC/Windows in general, but it isn't going to work with Command Bars. I'm going to post a more honed request in a different thread so consider this one dead. Jay |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
try. pCommandBars->GetMenuBar()->LoadMenu |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |