Click here to Skip to main content
15,916,846 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General[OT]: 2 new questions Pin
User 665816-Feb-04 12:06
User 665816-Feb-04 12:06 
GeneralRe: [OT]: 2 new questions Pin
Christian Graus16-Feb-04 12:45
protectorChristian Graus16-Feb-04 12:45 
GeneralRe: if-Statement getting me crazy Pin
Toni7816-Feb-04 15:23
Toni7816-Feb-04 15:23 
GeneralRe: if-Statement getting me crazy Pin
Maxwell Chen16-Feb-04 18:02
Maxwell Chen16-Feb-04 18:02 
Generallist ctrl help-- if new item selected, validate old, and keep old if validation fails Pin
hiseldl16-Feb-04 8:40
hiseldl16-Feb-04 8:40 
GeneralRe: list ctrl help-- if new item selected, validate old, and keep old if validation fails Pin
SolarPanel+16-Feb-04 12:31
SolarPanel+16-Feb-04 12:31 
GeneralImport a "C" function that returns a struct... Pin
sammyh16-Feb-04 8:25
sammyh16-Feb-04 8:25 
GeneralRe: Import a "C" function that returns a struct... Pin
Robert A. T. Káldy17-Feb-04 0:42
Robert A. T. Káldy17-Feb-04 0:42 
Generallocking toolbars in place ... Pin
Maximilien16-Feb-04 7:47
Maximilien16-Feb-04 7:47 
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 

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.