用于创建或 subclassing 窗口的方法。
重要
该类及其成员无法在 Windows 运行时中执行的应用程序中使用。
template <
class T,
class TBase= CWindow,
class TWinTraits= CControlWinTraits
>
class ATL_NO_VTABLE CWindowImpl :
public CWindowImplBaseT< TBase, TWinTraits>
参数
T
您的新类从 CWindowImpl 派生TBase
您的选件类基类。 默认情况下,基类为 CWnd。TWinTraits
定义了窗口的样式的 特征选件类。 默认值为 CControlWinTraits。
成员
公共方法
名称 |
描述 |
---|---|
创建一个窗口。 |
CWindowImplBaseT 方法
提供一个默认值处理消息。 |
|
返回当前消息。 |
|
返回当前窗口过程。 |
|
调用最后一条消息后接收 (通常 WM_NCDESTROY)。 |
|
对窗口进行子分类。 |
|
恢复一个先前派生子类窗口 |
静态方法
返回 CWndClassInfo静态实例,管理窗口选件类信息。 |
|
处理发送到窗口。 |
数据成员
指向窗口选件类的原始窗口过程。 |
备注
可以使用 CWindowImpl 创建窗口或子类现有的窗口。CWindowImpl 窗口过程使用消息映射处理消息的适当处理程序。
CWindowImpl::Create 创建根据 CWndClassInfo托管 windows 选件类信息的窗口。 CWindowImpl 包含 DECLARE_WND_CLASS 宏,这意味着 CWndClassInfo 注册新的 windows 选件类。 如果要创建超类时现有窗口选件类,从 CWindowImpl 派生您的选件类并包含 DECLARE_WND_SUPERCLASS 宏。 在这种情况下,CWndClassInfo 注册基于现有选件类,但在窗口选件类使用 CWindowImpl::WindowProc。 例如:
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
备注
由于 CWndClassInfo 管理 windows 选件类的信息,通过 CWindowImpl 创建实例的每个窗口都根据同一窗口选件类。
CWindowImpl 还支持 subclassing 的窗口。 SubclassWindow 方法附加现有的窗口。CWindowImpl 对象和更改 windows 程序。CWindowImpl::WindowProc。 CWindowImpl 每个实例可以子类访问其他窗口。
备注
对于任何给定 CWindowImpl 对象,请调用 创建 或 SubclassWindow。不要对同一对象的两种方法。
除了 CWindowImpl外,ATL 提供 CContainedWindow 创建在另一个对象包含的窗口。
基类析构函数 (|)CWindowImplRoot确保窗口转到,在销毁之前对象。
CWindowImpl 从 CWindowImplBaseT派生,从 CWindowImplRoot派生,从 TBase 和 CMessageMap派生。
有关以下内容的更多信息 |
请参见 |
---|---|
创建控件 |
|
使用 ATL的窗口 |
|
ATL 项目向导 |
继承层次结构
TBase
CWindowImplRoot
CWindowImplBaseT
CWindowImpl
要求
标头: atlwin.h