Share via


CWindowImpl 類別

這個類別會建立或分為子視窗的方法。

重要

這個類別和其成員不能用於 Windows 執行階段執行的應用程式。

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

參數

  • T
    您的類別,衍生自 CWindowImpl

  • TBase
    您的新類別的基底類別。 預設基底類別是 CWindow

  • TWinTraits
    定義自己的視窗樣式的 字元類別 。 預設值為 CControlWinTraits

Members

h4616bh2.collapse_all(zh-tw,VS.110).gif公用方法

名稱

描述

CWindowImpl::Create

建立視窗。

h4616bh2.collapse_all(zh-tw,VS.110).gifCWindowImplBaseT 方法

DefWindowProc

提供預設的訊息處理。

GetCurrentMessage

傳回目前的訊息。

GetWindowProc

傳回目前視窗程序。

OnFinalMessage

最後一個呼叫在接收訊息之後 (通常是 WM_NCDESTROY)。

SubclassWindow

子類別視窗。

UnsubclassWindow

還原先前子視窗。

h4616bh2.collapse_all(zh-tw,VS.110).gif靜態方法

GetWndClassInfo

傳回 CWndClassInfo靜態執行個體,管理視窗類別的資訊。

WindowProc

處理傳送至視窗。

h4616bh2.collapse_all(zh-tw,VS.110).gif資料成員

m_pfnSuperWindowProc

將視窗類別的原始視窗程序的點。

備註

CWindowImpl 可讓您建立新的 Windows 或子類別現有視窗。 CWindowImpl 的 Windows 程序的訊息對應導向訊息給適當的處理常式。

CWindowImpl::Create 會根據 Windows 類別資訊的新視窗管理 CWndClassInfoCWindowImpl 包含 DECLARE_WND_CLASS 巨集,表示 CWndClassInfo 會註冊新的視窗類別。 如果您想要設定為 Superclass 的現有視窗類別,從 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 方法附加現有 Windows CWindowImpl 物件並變更視窗程序加入至 CWindowImpl::WindowProcCWindowImpl 每個執行個體的子類別可以在中不同的視窗。

注意事項注意事項

對於任何特定的 CWindowImpl 物件,請呼叫 建立SubclassWindow。您不應該叫用相同物件的兩個方法。

除了之外, CWindowImplATL 提供 CContainedWindow 建立在另一個物件內的視窗。

基底類別解構函式 (|)CWindowImplRoot保證視窗移至 ,以在終結物件之前。

CWindowImplCWindowImplBaseT衍生,從 CWindowImplRoot衍生,從 TBaseCMessageMap又衍生自。

如需詳細資訊

請參閱

建立控制項

ATL 教學課程

使用 ATL 中的視窗

ATL 視窗類別

ATL 專案精靈

建立 ATL 專案

視窗

如需視窗程序

繼承階層架構

CMessageMap

TBase

CWindowImplRoot

CWindowImplBaseT

CWindowImpl

需求

Header: atlwin.h

請參閱

參考

BEGIN_MSG_MAP

CComControl 類別

其他資源

ATL 類別概觀