CreateWindowEx

  HWND CreateWindowEx(dwExStyle, lpszClass, lpszWindowName, dwStyle, x, y, nWidth, nHeight, hwndOwner, hmenu, hinst, lpvCreateParams)    
  DWORD dwExStyle; /* extended window style */
  LPCTSTR lpszClass; /* address of registered class name */
  LPCTSTR lpszWindowName; /* address of window text */
  DWORD dwStyle; /* window style */
  int x; /* horizontal position of the window */
  int y; /* vertical position of the window */
  int nWidth; /* window width */
  int nHeight; /* window height */
  HWND hwndOwner; /* handle of parent window */
  HMENU hmenu; /* handle of menu or child-window identifier */
  HANDLE hinst; /* handle of application instance */
  LPVOID lpvCreateParams; /* address of window-creation data */

The CreateWindowEx function creates an overlapped, pop-up, or child window with an extended style; otherwise, this function is identical to the CreateWindow function. For more information about creating a window and for full descriptions of the other parameters of CreateWindowEx, see the preceding description of the CreateWindow function.

Parameters

dwExStyle

Specifies the extended style of the window. It may be one of the following values:

Style Meaning

WS_EX_ACCEPTFILES  
  Specifies that a window created with this style accepts drag-drop files.
WS_EX_DLGMODALFRAME  
  Designates a window with a double border that may (optionally) be created with a title bar by specifying the WS_CAPTION style flag in the dwStyle parameter.
WS_EX_NOPARENTNOTIFY  
  Specifies that a child window created by using this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.
WS_EX_TOPMOST  
  Specifies that a window created with this style should be placed above all non-topmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos function to add or remove this attribute.
WS_EX_TRANSPARENT  
  Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window.

lpszClass

Points to a null-terminated string or is an atom that identifies a string. If this parameter is an atom, it must be a global atom created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of lpszClass; the high-order word must be zero.

The lpszClass string or atom specifies the window class name.

lpszWindowName

Points to a null-terminated string containing the name of the window.

dwStyle

Specifies the style of the window being created. For a list of the window styles that can be specified in this parameter, see the preceding description of the CreateWindow function.

x

Specifies the initial left-side position of the window.

y

Specifies the initial top position of the window.

nWidth

Specifies the width, in device units, of the window.

nHeight

Specifies the height, in device units, of the window.

hwndOwner

Identifies the parent or owner window of the to be created.

hmenu

Identifies a menu or a child window. The meaning depends on the window style.

hinst

Identifies the instance of the module to be associated with the window.

lpvCreateParams

Contains any application-specific creation parameters. The window being created may access this data when the CREATESTRUCT structure is passed to the window by the WM_NCCREATE and WM_CREATE messages.

The CREATESTRUCT structure has the following form:

typedef struct tagCREATESTRUCT { /* cs */

LPVOID lpCreateParams;

HANDLE hInstance;

HMENU hMenu;

HWND hwndParent;

int cy;

int cx;

int y;

int x;

LONG style;

LPCSTR lpszName;

LPCSTR lpszClass;

DWORD dwExStyle;

} CREATESTRUCT;

Return Value

The return value identifies the new window if the function is successful. Otherwise, it is NULL.

Comments

The CreateWindowEx function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

The CreateWindowEx function sends the following messages to the window being created:

WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE

See the description of the CreateWindow function for the window control classes, window styles and control styles that can be used with this function.

See Also

CreateWindow, SetWindowPos