CreateMDIWindowW function (winuser.h)

Creates a multiple-document interface (MDI) child window.

Syntax

HWND CreateMDIWindowW(
  [in]           LPCWSTR   lpClassName,
  [in]           LPCWSTR   lpWindowName,
  [in]           DWORD     dwStyle,
  [in]           int       X,
  [in]           int       Y,
  [in]           int       nWidth,
  [in]           int       nHeight,
  [in, optional] HWND      hWndParent,
  [in, optional] HINSTANCE hInstance,
  [in]           LPARAM    lParam
);

Parameters

[in] lpClassName

Type: LPCTSTR

The window class of the MDI child window. The class name must have been registered by a call to the RegisterClassEx function.

[in] lpWindowName

Type: LPCTSTR

The window name. The system displays the name in the title bar of the child window.

[in] dwStyle

Type: DWORD

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 Window Styles page. Otherwise, this parameter is limited to one or more of the following values.

Value Meaning
WS_MINIMIZE
0x20000000L
Creates an MDI child window that is initially minimized.
WS_MAXIMIZE
0x01000000L
Creates an MDI child window that is initially maximized.
WS_HSCROLL
0x00100000L
Creates an MDI child window that has a horizontal scroll bar.
WS_VSCROLL
0x00200000L
Creates an MDI child window that has a vertical scroll bar.

[in] X

Type: int

The initial horizontal position, in client coordinates, of the MDI child window. If this parameter is CW_USEDEFAULT ((int)0x80000000), the MDI child window is assigned the default horizontal position.

[in] Y

Type: int

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.

[in] nWidth

Type: int

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.

[in] nHeight

Type: int

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.

[in, optional] hWndParent

Type: HWND

A handle to the MDI client window that will be the parent of the new MDI child window.

[in, optional] hInstance

Type: HINSTANCE

A handle to the instance of the application creating the MDI child window.

[in] lParam

Type: LPARAM

An application-defined value.

Return value

Type: HWND

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

Note

The winuser.h header defines CreateMDIWindow as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

CreateWindow

Multiple Document Interface

Reference

RegisterClassEx

WM_MDICREATE