Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lose MDIChild management when reloading menu bar :-(

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
Hello,<br><br>I find some not cool problem with MDI applications. When I reload the menu bar of<br>the main frame, the managing of links to the MDI child windows is lose. That is,<br>in the pop-up menu &quot;Windows&quot; (in fact, &quot;Fenêtres&quot; in my french application), the :<br><br>1 MyDocument1<br>2 MyDocument2<br>3 ...<br><br>Below the splitter bar disappear for the windows previously already open. Also,<br>when the user open new documents (or create them), the link to the MDI childs are<br>not automatically added to the menu.<br><br>This is the code I type to reload the menu bar of the main frame <br>(method of the main frame object, so 'this' is a CMDIFrameWnd child object) :<br><br>m_pAppMenu-&gt;DestroyMenu(); // removes the old menu bar. Maybe I should add this-&gt;SetMenu(NULL); before (?).<br>if ( m_pAppMenu-&gt;LoadMenu(IDR_SHAREDMENU) ) // Loads the new menu bar in the member.<br>{<br> m_hMenuDefault=m_pAppMenu-&gt;m_hMenu;<br> this-&gt;SetMenu(m_pAppMenu); // Says to the main frame that this is the new manu bar.<br>}<br>this-&gt;DrawMenuBar(); // Draws the new menu bar...<br><br>Notice that m_pAppMenu is a CMenu*, member of the object I derived from<br>CMDIFrameWnd, and point to the menu bar of the main frame.<br><br>Does it exist a way to de-attach the pop-up menu that deals with windows and re-attach<br>it after ? I only find how to attach and de-attach whole menu from a CMenu object, but<br>not (only) a part of it.<br><br>Or maybe there is a way dealing with the doc manager which take care of the opened<br>documents ? I try to find where (in the code of MFC) the links are added to the menu<br>bar, but I failed to find this.<br><br>Any idea ?<br><br>David Burg.
 
David,<br><br>My idea is that you might not be using an appropriate technique to change your menu in an MFC MDI framework application.<br><br>Take a look at the documentation for:<br><br>CMDIFrameWnd::MDISetMenu<br><br>Also there are several example MFC MDI application on msdn.microsoft.com. I suggest you study them to see if they provide examples of any behavior you might try to introduce into your application.<br><br>Good luck<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top