Compartilhar via


CWindow::Create

Creates a window.

HWND Create(
   LPCTSTR lpstrWndClass, 
   HWND hWndParent, 
   _U_RECT rect = NULL, 
   LPCTSTR szWindowName = NULL,
   DWORD dwStyle = 0, 
   DWORD dwExStyle = 0,
   _U_MENUorID MenuOrID = 0U, 
   LPVOID lpCreateParam = NULL
) throw(); 

Parameters

  • lpstrWndClass
    [in] A pointer to the window's class.

  • hWndParent
    [in] The handle to the parent or owner window.

  • rect
    [in] A variable of type _U_RECT specifying the position of the window. The default value is NULL. When this parameter is NULL, the value of CWindow::rcDefault is used.

  • szWindowName
    [in] Specifies the name of the window. The default value is NULL.

  • dwStyle
    [in] The style of the window. The default value is 0, meaning no style is specified. For a list of possible values, see CreateWindow in the Windows SDK.

  • dwExStyle
    [in] The extended window style. The default value is 0, meaning no extended style is specified. For a list of possible values, see CreateWindowEx in the Windows SDK.

  • MenuOrID
    [in] A variable of type _U_MENUorID specifying a handle to a menu or a window identifier. The default value is 0U.

  • lpCreateParam
    A pointer to the window-creation data contained in a CREATESTRUCT structure.

Return Value

If successful, the handle to the newly created window, specified by m_hWnd. Otherwise, NULL.

Remarks

CWindow::rcDefault is defined as __declspec(selectany) RECT CWindow::rcDefault = {CW_USEDEFAULT, CW_USEDEFAULT, 0, 0};.

See CreateWindow in the Windows SDK for more information.

Note   If 0 is used as the value for the MenuOrID parameter, it must be specified as 0U (the default value) to avoid a compiler error.

Requirements

Header: atlwin.h

See Also

Reference

CWindow Class

CWindow::m_hWnd

Other Resources

CWindow Members