MFC - Adding a Toolbar to An MDI Child


See the section on adding a toolbar to a normal Frame window.

The key to this is to create a new class which inherits from the CMDIChildWindow class. Add the function OnCreate - see CWnd help for the format of this virtual function.

In OnCreate add in similar code to the other section to create the toolbar.

In the App IniInstance function change :

 

pDocTemplate = new CMultiDocTemplate(  IDR_INVISWTYPE,
                                       RUNTIME_CLASS(CInvisWin2Doc),
                                       RUNTIME_CLASS(CMyChild), // custom MDI child window
                                       RUNTIME_CLASS(CInvisWin2View));
AddDocTemplate(pDocTemplate);

Remember to include the header for your custom window class in the App source file.

Sorry but that's it !!

 


Index