Compartilhar via


CContainedWindowT::Create

Calls RegisterWndSuperclass to register a window class that is based on an existing class but uses CContainedWindowT::WindowProc.

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

Parameters

  • lpszClassName
    [in] The name of an existing window class on which the contained window will be based.

  • pObject
    [in] A pointer to the containing object that declares the message map. This object's class must derive from CMessageMap.

  • dwMsgMapID
    [in] Identifies the message map that will process the contained window's messages. The default value, 0, specifies the default message map declared with BEGIN_MSG_MAP. To use an alternate message map declared with ALT_MSG_MAP(msgMapID), pass msgMapID.

  • 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. The default value is WS_CHILD | WS_VISIBLE. 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. 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

The existing window class name is saved in m_lpszClassName. Create then creates a window based on this new class. The newly created window is automatically attached to the CContainedWindowT object.

Note

Do not call Create if you have already called SubclassWindow.

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

CContainedWindowT Class

CWindow::m_hWnd