Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: locking toolbars in place ... Pin
David Crow16-Feb-04 7:59
David Crow16-Feb-04 7:59 
GeneralScientific Notation Pin
Walt_S16-Feb-04 6:28
Walt_S16-Feb-04 6:28 
GeneralRe: Scientific Notation Pin
David Crow16-Feb-04 7:22
David Crow16-Feb-04 7:22 
GeneralRe: Scientific Notation Pin
Walt_S16-Feb-04 7:27
Walt_S16-Feb-04 7:27 
QuestionHow to access and Modify the Child Window Menu Pin
Omar Alvi16-Feb-04 6:20
Omar Alvi16-Feb-04 6:20 
AnswerRe: How to access and Modify the Child Window Menu Pin
Antti Keskinen16-Feb-04 9:49
Antti Keskinen16-Feb-04 9:49 
GeneralRe: How to access and Modify the Child Window Menu Pin
Omar Alvi16-Feb-04 18:14
Omar Alvi16-Feb-04 18:14 
GeneralRe: How to access and Modify the Child Window Menu Pin
Antti Keskinen16-Feb-04 22:01
Antti Keskinen16-Feb-04 22:01 
As the framework alters the frame window's menu when a child gets activated, it is possible to access this menu through the CWnd::GetMenu routine. Then, you can alter the menu using CMenu operations. Although the menu resides on the parent frame's menu bar, nothing prevents you from altering it in the standard way. If you want to be certain, call GetMenu for the child frame. This, for certain, should return the child frame's menu that is currently visible on the parent frame's menu bar.

Furthermore, when a child window is activated (it's title bar is clicked), a Windows message WM_MDIACTIVATE is generated and sent to the frame that is being activated as well as to the frame that is being deactivated. That is, two messages in total. For the child frame class, the default handler of CMDIFrameWnd answers to this message by modifying the parent's menu. You could add to this, by first calling the base class (to modify the menu), then use CWnd::GetMenu to return the menu and do additional modifications to it.

This way, you would only need to write the basic layout of the menu as a resource, then modify it on-the-fly as required.

There is a function called OnMDIActivate implemented in the CWnd class. If I remember correctly, the same function is declared in the header file that defined CMDIChildWnd, and it is declared virtual in there. If this is correct, you can override it straight through in your derived class to implement the above idea. I am not completely sure whether this approach will work, but it's at least something concrete you could try.

Naturally, everytime the designated child frame is active, you can use CWnd::GetMenu to modify the currently active menu, thus adding the list of currently open documents. However, I am not certain if these changes last over frame deactivation/re-activation..

Hope this will help..

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralToolBar problem Pin
Deian16-Feb-04 6:03
Deian16-Feb-04 6:03 
GeneralRe: ToolBar problem Pin
LunaticFringe16-Feb-04 7:47
LunaticFringe16-Feb-04 7:47 
GeneralRe: ToolBar problem Pin
Deian16-Feb-04 7:54
Deian16-Feb-04 7:54 
GeneralGDI+ Pin
Prakash Nadar16-Feb-04 5:40
Prakash Nadar16-Feb-04 5:40 
GeneralRe: GDI+ Pin
Steve S16-Feb-04 6:19
Steve S16-Feb-04 6:19 
GeneralRe: GDI+ Pin
Prakash Nadar16-Feb-04 16:44
Prakash Nadar16-Feb-04 16:44 
GeneralPrinting Icons Pin
Julio Garvía Honrado16-Feb-04 5:22
sussJulio Garvía Honrado16-Feb-04 5:22 
Questionhow to detect bluetooth ports on different windows platforms? Pin
haritadala16-Feb-04 5:09
haritadala16-Feb-04 5:09 
GeneralStrange behaviour of VC6 on XP pro Pin
Bin2Hex16-Feb-04 4:58
Bin2Hex16-Feb-04 4:58 
GeneralDynamic list view Pin
status16-Feb-04 4:52
status16-Feb-04 4:52 
GeneralRe: Dynamic list view Pin
David Crow16-Feb-04 7:25
David Crow16-Feb-04 7:25 
GeneralRe: Dynamic list view Pin
status16-Feb-04 21:44
status16-Feb-04 21:44 
GeneralRe: Dynamic list view Pin
David Crow17-Feb-04 2:19
David Crow17-Feb-04 2:19 
GeneralRe: Dynamic list view Pin
status17-Feb-04 21:20
status17-Feb-04 21:20 
GeneralSetting the width of a subclassed Spin Button Pin
jlmiramo16-Feb-04 4:34
jlmiramo16-Feb-04 4:34 
Generalavoid scientific numbers Pin
Mediate16-Feb-04 3:18
Mediate16-Feb-04 3:18 
GeneralRe: avoid scientific numbers Pin
Tim Smith16-Feb-04 4:10
Tim Smith16-Feb-04 4:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.