Prev Next

CreateMDIWindow info  Overview  Group

The CreateMDIWindow function creates a multiple document interface (MDI) child window.

HWND CreateMDIWindow(

    LPTSTR lpClassName,

// pointer to registered child class name

    LPTSTR lpWindowName,

// pointer to window name

    DWORD dwStyle,

// window style

    int X,

// horizontal position of window

    int Y,

// vertical position of window

    int nWidth,

// width of window

    int nHeight,

// height of window

    HWND hWndParent,

// handle to parent window (MDI client)

    HINSTANCE hInstance,

// handle to application instance

    LPARAM lParam 

// application-defined value

   );

Parameters

lpClassName
Points to a null-terminated string specifying the window class of the MDI child window. The class name must have been registered by a call to the RegisterClass function.
lpWindowName
Points to a null-terminated string that represents the window name. Windows displays the name in the title bar of the child window.
dwStyle
Specifies the style of the MDI child window. If the MDI client window is created with the MDIS_ALLCHILDSTYLES window style, this parameter can be any combination of the window styles listed in the description of the CreateWindow function. Otherwise, this parameter can be one or more of the following values:

Value

Meaning

WS_MINIMIZE

Creates an MDI child window that is initially minimized.

WS_MAXIMIZE

Creates an MDI child window that is initially maximized.

WS_HSCROLL

Creates an MDI child window that has a horizontal scroll bar.

WS_VSCROLL

Creates an MDI child window that has a vertical scroll bar.

X
Specifies the initial horizontal position, in client coordinates, of the MDI child window. If this parameter is CW_USEDEFAULT, the MDI child window is assigned the default horizontal position.
Y
Specifies the initial vertical position, in client coordinates, of the MDI child window. If this parameter is CW_USEDEFAULT, the MDI child window is assigned the default vertical position.
nWidth
Specifies the initial width, in device units, of the MDI child window. If this parameter is CW_USEDEFAULT, the MDI child window is assigned the default width.
nHeight
Specifies the initial height, in device units, of the MDI child window. If this parameter is set to CW_USEDEFAULT, the MDI child window is assigned the default height.
hWndParent
Identifies the MDI client window that will be the parent of the new MDI child window.
hInstance
Identifies the instance of the application creating the MDI child window.
lParam
Specifies an application-defined value.

Return Values

If the function succeeds, the return value is the handle to the created window.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

Using the CreateMDIWindow function is similar to sending the WM_MDICREATE message to an MDI client window, except that the function can create an MDI child window in a different thread, while the message cannot.

Windows 95: The system can support a maximum of 16,364 window handles.

See Also

CreateWindow, RegisterClass, WM_MDICREATE