CWindowImpl Class
Provides methods for creating or subclassing a window.
Important
This class and its members cannot be used in applications that execute in the Windows Runtime.
template <
class T,
class TBase= CWindow,
class TWinTraits= CControlWinTraits
>
class ATL_NO_VTABLE CWindowImpl :
public CWindowImplBaseT< TBase, TWinTraits>
Parameters
T
Your new class, derived from CWindowImpl.TBase
The base class of your class. By default, the base class is CWindow.TWinTraits
A traits class that defines styles for your window. The default is CControlWinTraits.
Members
Public Methods
Name |
Description |
---|---|
Creates a window. |
CWindowImplBaseT Methods
Provides default message processing. |
|
Returns the current message. |
|
Returns the current window procedure. |
|
Called after the last message is received (typically WM_NCDESTROY). |
|
Subclasses a window. |
|
Restores a previously subclassed window. |
Static Methods
Returns a static instance of CWndClassInfo, which manages the window class information. |
|
Processes messages sent to the window. |
Data Members
Points to the window class's original window procedure. |
Remarks
You can use CWindowImpl to create a window or subclass an existing window. the CWindowImpl window procedure uses a message map to direct messages to the appropriate handlers.
CWindowImpl::Create creates a window based on the window class information that's managed by CWndClassInfo. CWindowImpl contains the DECLARE_WND_CLASS macro, which means CWndClassInfo registers a new window class. If you want to superclass an existing window class, derive your class from CWindowImpl and include the DECLARE_WND_SUPERCLASS macro. In this case, CWndClassInfo registers a window class that's based on an existing class but uses CWindowImpl::WindowProc. For example:
class ATL_NO_VTABLE CMyWindow :
OtherInheritedClasses
public 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, _T("EDIT"))
// Remainder of class declaration omitted
Note
Because CWndClassInfo manages the information for just one window class, each window created through an instance of CWindowImpl is based on the same window class.
CWindowImpl also supports window subclassing. The SubclassWindow method attaches an existing window to the CWindowImpl object and changes the window procedure to CWindowImpl::WindowProc. Each instance of CWindowImpl can subclass a different window.
Note
For any given CWindowImpl object, call either Create or SubclassWindow. Don't invoke both methods on the same object.
In addition to CWindowImpl, ATL provides CContainedWindow to create a window that's contained in another object.
The base class destructor (~CWindowImplRoot) ensures that the window is gone before the object is destroyed.
CWindowImpl derives from CWindowImplBaseT, which derives from CWindowImplRoot, which derives from TBase and CMessageMap.
For more information about |
See |
---|---|
Creating controls |
|
Using windows in ATL |
|
ATL Project Wizard |
Inheritance Hierarchy
TBase
CWindowImplRoot
CWindowImplBaseT
CWindowImpl
Requirements
Header: atlwin.h