CWndClassInfo

class CWndClassInfo

CWndClassInfo manages the information of a window class. You typically use CWndClassInfo through one of two macros, DECLARE_WND_CLASS or DECLARE_WND_SUPERCLASS, as described in the following table:

MacroDescription
DECLARE_WND_CLASSCWndClassInfo registers information for a new window class.
DECLARE_WND_SUPERCLASSCWndClassInfo registers information for a window class that is based on an existing class but uses a different window procedure. This technique is called superclassing.

By default, CWindowImpl includes the DECLARE_WND_CLASS macro to create a window based on a new window class. If you want to create a window based on an existing window class, derive your class from CWindowImpl and include the DECLARE_WND_SUPERCLASS macro in your class definition. For example:

class CMyWindow : CComControl<CMyWindow>, ... 
                  // CComControl derives from CWindowImpl
{ 
public: 
   // 1. The NULL parameter means ATL will generate a 
   // name for the superclass 
   // 2. The "EDIT" parameter means the superclass is 
   // based on the standard Windows Edit box 
   DECLARE_WND_SUPERCLASS(NULL, "EDIT")
   ... 
}; 

For more information about window classes and superclassing, see "Window Classes" and "Window Procedure Superclassing" in the Win32 SDK.

For more information about using windows in ATL, see the article ATL Window Classes.

#include <atlwin.h>

See Also CComControl


CWndClassInfo Class Members

Methods
RegisterRegisters the window class.
Data Members
m_atomUniquely identifies the registered window class.
m_bSystemCursorSpecifies whether the cursor resource refers to a system cursor or to a cursor contained in a module resource.
m_lpszCursorIDSpecifies the name of the cursor resource.
m_lpszOrigNameContains the name of an existing window class.
m_szAutoNameHolds an ATL-generated name of the window class.
m_wcMaintains window class information in a WNDCLASSEX structure.
pWndProcPoints to the window procedure of an existing window class.

CWndClassInfo Overview


Methods


CWndClassInfo::Register

ATOM Register( WNDPROC* pProc );

Return Value

If successful, an atom that uniquely identifies the window class being registered. Otherwise, 0.

Parameters

pProc [out] Specifies the original window procedure of an existing window class.

Remarks

Called by CWindowImpl::Create to register the window class if it has not yet been registered.

If you have specified the DECLARE_WND_CLASS macro (the default in CWindowImpl), Register registers a new window class. In this case, the pProc parameter is not used.

If you have specified the DECLARE_WND_SUPERCLASS macro, Register registers a superclass—a window class that is based on an existing class but uses a different window procedure. The existing window class's window procedure is returned in pProc.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::m_atom, CWndClassInfo::m_wc, CWndClassInfo::pWndProc


Data Members


CWndClassInfo::m_atom

ATOM m_atom;

Remarks

Contains the unique identifier for the registered window class.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::Register


CWndClassInfo::m_bSystemCursor

BOOL m_bSystemCursor;

Remarks

If TRUE, the system cursor resource will be loaded when the window class is registered. Otherwise, the cursor resource contained in your module will be loaded.

CWndClassInfo uses m_bSystemCursor only when the DECLARE_WND_CLASS macro is specified (the default in CWindowImpl). In this case, m_bSystemCursor is initialized to TRUE. For more information, see the CWndClassInfo overview.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::m_lpszCursorID


CWndClassInfo::m_lpszCursorID

LPCTSTR m_lpszCursorID;

Remarks

Specifies either the name of the cursor resource or the resource identifier in the low-order word and zero in the high-order word. When the window class is registered, the handle to the cursor identified by m_lpszCursorID is retrieved and stored by m_wc.

CWndClassInfo uses m_lpszCursorID only when the DECLARE_WND_CLASS macro is specified (the default in CWindowImpl). In this case, m_lpszCursorID is initialized to IDC_ARROW. For more information, see the CWndClassInfo overview.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::m_bSystemCursor


CWndClassInfo::m_lpszOrigName

LPCTSTR m_lpszOrigName;

Remarks

Contains the name of an existing window class. CWndClassInfo uses m_lpszOrigName only when you include the DECLARE_WND_SUPERCLASS macro in your class definition. In this case, CWndClassInfo registers a window class based on the class named by m_lpszOrigName. For more information, see the CWndClassInfo overview.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::m_wc, CWndClassInfo::pWndProc


CWndClassInfo::m_szAutoName

TCHAR m_szAutoName[13];

Remarks

Holds the name of the window class. CWndClassInfo uses m_szAutoName only if NULL is passed for the WndClassName parameter to DECLARE_WND_CLASS or DECLARE_WND_SUPERCLASS. ATL will construct a name when the window class is registered.

CWndClassInfo Overview | Class Members


CWndClassInfo::m_wc

WNDCLASSEX m_wc;

Remarks

Maintains the window class information in a WNDCLASSEX structure.

If you have specified the DECLARE_WND_CLASS macro (the default in CWindowImpl), m_wc contains information about a new window class.

If you have specified the DECLARE_WND_SUPERCLASS macro, m_wc contains information about a superclass—a window class that is based on an existing class but uses a different window procedure. m_lpszOrigName and pWndProc save the existing window class's name and window procedure, respectively.

CWndClassInfo Overview | Class Members


CWndClassInfo::pWndProc

WNDPROC pWndProc;

Remarks

Points to the window procedure of an existing window class. CWndClassInfo uses pWndProc only when you include the DECLARE_WND_SUPERCLASS macro in your class definition. In this case, CWndClassInfo registers a window class that is based on an existing class but uses a different window procedure. The existing window class's window procedure is saved in pWndProc. For more information, see the CWndClassInfo overview.

CWndClassInfo Overview | Class Members

See Also CWndClassInfo::m_wc, CWndClassInfo::m_lpszOrigName