다음을 통해 공유


CWindowImpl::Create

Creates a window based on a new window class.

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

Parameters

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

  • rect
    [in] A RECT structure specifying the position of the window. The RECT can be passed by pointer or by reference.

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

  • dwStyle
    [in] The style of the window. This value is combined with the style provided by the traits class for the window. The default value gives the traits class full control over the style. For a list of possible values, see CreateWindow in the Windows SDK.

  • dwExStyle
    [in] The extended window style. This value is combined with the style provided by the traits class for the window. The default value gives the traits class full control over the style. For a list of possible values, see CreateWindowEx in the Windows SDK.

  • MenuOrID
    [in] For a child window, the window identifier. For a top-level window, a menu handle for the window. The default value is 0U.

  • lpCreateParam
    [in] A pointer to window-creation data. For a full description, see the description for the final parameter to CreateWindowEx.

Return Value

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

Remarks

Create first registers the window class if it has not yet been registered. The newly created window is automatically attached to the CWindowImpl object.

Note

Do not call Create if you have already called SubclassWindow.

To use a window class that is based on an existing window class, derive your class from CWindowImpl and include the DECLARE_WND_SUPERCLASS macro. The existing window class's window procedure is saved in m_pfnSuperWindowProc. For more information, see the CWindowImpl overview.

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

CWindowImpl Class

CWindowImpl::GetWndClassInfo

CWndClassInfo::Register

CWindow::m_hWnd