Share via


CWindowImpl クラス

このクラスには、ウィンドウを作成またはサブクラス化するためのメソッドが用意されています。

template <
   class T,
   class TBase = CWindow,
   class TWinTraits = CControlWinTraits 
>
class ATL_NO_VTABLE CWindowImpl :
   public CWindowImplBaseT< TBase, TWinTraits >

パラメーター

  • T
    CWindowImpl の派生クラス。

  • TBase
    新規作成するクラスの基本クラス。 既定の基本クラスは CWindow です。

  • TWinTraits
    ウィンドウのスタイルを定義する特徴 (traits) クラス。 既定値は、CControlWinTraits です。

解説

CWindowImpl では、新しいウィンドウを作成したり、既存のウィンドウをサブクラス化したりできます。 CWindowImpl のウィンドウ プロシージャは、メッセージ マップを使ってメッセージを適切なハンドラーに送ります。

CWindowImpl::Create は、CWndClassInfo が管理するウィンドウ クラスの情報に基づいて新規のウィンドウを作成します。 CWindowImpl には、DECLARE_WND_CLASS マクロが含まれています。つまり、CWndClassInfo が新しいウィンドウ クラスを登録します。 既存のウィンドウ クラスをスーパークラス化する場合は、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 は単一のウィンドウ クラスの情報を管理するため、CWindowImpl のインスタンスを使用して作成される各ウィンドウは、同じウィンドウ クラスに基づくことになります。

CWindowImpl は、ウィンドウのサブクラス化もサポートします。 SubclassWindow メソッドは、既存のウィンドウを CWindowImpl オブジェクトにアタッチし、ウィンドウ プロシージャを CWindowImpl::WindowProc に変更します。 CWindowImpl の各インスタンスは、それぞれ別のウィンドウをサブクラス化できます。

注意

指定された CWindowImpl オブジェクトに対しては、Create または SubclassWindow のいずれかを呼び出します。 同じオブジェクトに対して両方のメソッドを呼び出さないでください。

CWindowImpl のほかにも、ATL (Active Template Library) には別のオブジェクトに含まれているウィンドウを作成するための CContainedWindow が用意されています。

基本クラスのデストラクター (~CWindowImplRoot) は、必ずウィンドウを破棄してからオブジェクトを破棄します。

CWindowImplCWindowImplBaseT の派生クラスです。CWindowImplBaseTCWindowImplRoot の派生クラスです。CWindowImplRootTBaseCMessageMap を継承しています。

項目

詳細情報

コントロールの作成

ATL チュートリアル

ATL でのウィンドウの使い方

ATL ウィンドウ クラス

ATL プロジェクト ウィザード

ATL プロジェクトの作成

Windows

About Windows Procedures

必要条件

**ヘッダー:**atlwin.h

参照

参照

BEGIN_MSG_MAP

CComControl クラス

その他の技術情報

CWindowImpl のメンバー

ATL クラスの概要