To create an MDI child window, the application sends a WM_MDICREATE message to the MDI client. (The application must not use the CreateWindow function to create MDI child windows.) The lParam parameter of a WM_MDICREATE message is a far pointer to a structure called MDICREATESTRUCT, which contains members similar to CreateWindow function parameters.
Multipad creates its MDI child windows by using its locally defined AddFile
function (located in the source file MPFILE.C). The AddFile function sets the
title of the child window by assigning the szTitle member of the window's MDICREATESTRUCT structure to either the name of the file being edited or to “Untitled.” The szClass member is set to the name of the MDI child-window class registered in the Multipad InitializeApplication function. The owner hOwner member is set to the application's instance handle.
The MDICREATESTRUCT structure contains four dimension members: x and y, which are the position of the window, and cx and cy, the horizontal and vertical extents of the window. Any of these may be assigned explicitly by the application or may be set to CW_USEDEFAULT, in which case Windows picks a position or size or both according to a cascading algorithm. All four fields must be initialized in all cases. Multipad uses CW_USEDEFAULT for all dimensions.
The last member is the style member, which may contain style bits for the window. To create an MDI child window that can have any combination of window styles, specify MDIS_ALLCHILDSTYLES for the window style. When this style is not specified, an MDI child window has the WS_MINIMIZE, WS_MAXIMIZE, WS_HSCROLL, and WS_VSCROLL styles as default settings.
You can use the WS_MINIMIZE or WS_MAXIMIZE bit to set the original state of the window.
The pointer passed in the lParam parameter of the WM_MDICREATE message is passed to CreateWindow and appears as the first member in the CREATESTRUCT structure passed in the WM_CREATE message. In Multipad, the child window initializes itself during WM_CREATE message processing by initializing document variables in its extra data and by creating the edit control's child window.