The MDI frame window is always an application's main window, so you construct it in the application object's InitMainWindow member function.
MDI frame windows differ from other frame windows in the following ways:
- Because an MDI frame is always a main window, it never has a parent. Therefore, TMDIFrame's constructor does not take a pointer to a parent window object as a parameter.
- An MDI frame must have a menu, so TMDIFrame's constructor takes a menu resource identifier as a parameter. With non-MDI main frame windows, you would call AssignMenu() to set the window's menu. TMDIFrame's constructor makes the call for you. Part of what AssignMenu does is search the menu for the child-window menu by searching for certain menu command IDs. If it finds a Window menu, new child window titles are automatically added to the bottom of the menu.
Example
A typical InitMainWindow for an MDI application would look like this:
void TMDIApp::InitMainWindow()
{
}
The example creates an MDI frame window titled "MDI App" with a menu from the ID_MENU resource. The ID_MENU menu should have a child-window menu. The MDI client window is created from the TMyMDIClient class.
See Also