CreateWindowExW function

Creates a top-level window. This structure is more flexible than the CreateWindow function because it can specify WNDCLASSEX structure members that cannot be inherited.
HWND CreateWindowExW( DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );

Parameters

dwExStyle [in]

Extended window styles. This parameter can be a combination of the window extended style values.

lpClassName [in]

A null-terminated string of the window class name. Can be any registered class name or any of the system-defined class names.

lpWindowName [in]

The window name. The window name appears in the title bar of the window. If this parameter is NULL, the class name is used.

dwStyle [in]

The style of the window. This parameter can be a combination of the window style values.

x [in]

The position of the window's left side, in screen coordinates. The value can be CW_USEDEFAULT.

y [in]

The position of the window's top side, in screen coordinates. The value can be CW_USEDEFAULT.

nWidth [in]

The width, in screen coordinates, of the window. The value can be CW_USEDEFAULT.

nHeight [in]

The height, in screen coordinates, of the window. The value can be CW_USEDEFAULT.

hWndParent [in]

Handle to the parent window, if the window is a child window. This parameter is required for child windows. If the window is not a child window, this parameter can be NULL.

hMenu [in]

Handle to a menu, or specifies a child-window identifier, depending on the type of window intended.

hInstance [in]

Handle to the instance of the module creating the window.

lpParam [in]

Pointer to a value to be passed to the window through WM_CREATE. If this parameter is NULL, no message is sent.

Return value

HWND

If the function succeeds, the return value is a handle to the newly created window. If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The CreateWindowExW function creates an overlapping, pop-up, or child window. It can also create windows that are not displayed until the application calls the ShowWindow function.

The CreateWindowExW function sends the WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the window being created.

If the dwExStyle parameter specifies WS_EX_CLIENTEDGE, the system adds a border to the window. This border is a 3-pixel-wide, sunken-edge border. For a standard window, the client area is 3 pixels smaller on each side than the window rectangle.

Note The CreateWindow function is equivalent to calling CreateWindowExW with dwExStyle set to 0.

Requirements

SDK: Included in Windows Vista, Windows 7, Windows 8, Windows 10

Header: winuser.h (include Windows.h)