깊이 분석:C+템 플 릿 이 코드 를 팽창 시 킬 수 있 습 니까?
MFC 는 자체 코드 의 양 과 복잡성 이 거기에 있 기 때문에 비교적 큰 exe 를 생 성 하 는 것 은 나 무 랄 데 가 없다.우 리 는 ATL/WTL 이 왜 템 플 릿 을 사용 하 는 지 에 중점 을 두 지만 생 성 된 exe 를 크게 만 들 지 는 않 는 다.
템 플 릿 을 사용 할 때 같은 템 플 릿 이 서로 다른 템 플 릿 실 류 를 생 성 한 후에 여러 개의 코드 가 생 성 된다 는 것 을 알 고 있 습 니 다.예 를 들 어 vector
그렇다면 왜 ATL/WTL 은 코드 팽창 의 문제 가 없 습 니까?저 는 ATL 의 창 코드 를 예 로 들 어 이 문 제 를 분석 합 니 다.왜냐하면 저 는 WinDbg 에 대해 잘 알 고 있 기 때 문 입 니 다.다음은 WinDbg 를 도구 로 제 가 예전 에 쓴 러시아 블록 프로그램 을 분석 하 겠 습 니 다.
먼저 ATL 의 창 코드 를 살 펴 보 겠 습 니 다.
template <class T, class TBase /* = CWindow */, class TWinTraits /* = CControlWinTraits */>
class ATL_NO_VTABLE CWindowImpl : public CWindowImplBaseT< TBase, TWinTraits >
{
public:
DECLARE_WND_CLASS(NULL)
static LPCTSTR GetWndCaption()
{
return NULL;
}
HWND Create(HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL,
DWORD dwStyle = 0, DWORD dwExStyle = 0,
_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
{
if (T::GetWndClassInfo().m_lpszOrigName == NULL)
T::GetWndClassInfo().m_lpszOrigName = GetWndClassName();
ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc);
dwStyle = T::GetWndStyle(dwStyle);
dwExStyle = T::GetWndExStyle(dwExStyle);
// set caption
if (szWindowName == NULL)
szWindowName = T::GetWndCaption();
return CWindowImplBaseT< TBase, TWinTraits >::Create(hWndParent, rect, szWindowName,
dwStyle, dwExStyle, MenuOrID, atom, lpCreateParam);
}
};
위 에는 템 플 릿 클래스 가 있 습 니 다.여러 템 플 릿 인 스 턴 스 코드 가 생 성 될 것 입 니 다.WinDbg 의 기호 검색 명령 으로 검증 할 수 있 습 니 다.x HYTeris 를 입력 하 십시오!ATL::CWindowImpl<*,모든 것 을 HYTeris 로 검색 하 세 요!ATL::CWindowImpl<시작 하 는 기호
0:000> x HYTeris!ATL::CWindowImpl<*
004592f0 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004343a0 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00437c90 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00430440 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> > (void)
0041c990 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
0044cf50 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
004539a0 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00435800 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00434640 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
00437440 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::GetWndCaption (void)
00436020 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00453f70 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00424e30 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
004338a0 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0041c4f0 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00441b50 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
004365f0 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00455120 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
0040ea20 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00453fa0 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
0041abc0 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00459c20 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0045f640 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004608a0 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndClassInfo (void)
0045fed0 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00433a70 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00437c60 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
0044fb70 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0041acf0 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00459510 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00437a90 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00430490 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::~CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> > (void)
00424de0 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00433ac0 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00433850 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00433b60 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00452050 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0044f8e0 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0044cec0 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
004340e0 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00433ef0 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
004348c0 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::~CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > (void)
004535b0 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
00454170 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00459c70 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00451ed0 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00451f20 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0045c4b0 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00436320 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004536a0 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004604a0 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::GetWndCaption (void)
0040eca0 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
0045ff90 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
00437cc0 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
004366e0 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
0045e620 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004608d0 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndCaption (void)
004520a0 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
0045d210 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > (void)
004d84a8 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d84b8 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d7970 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d7960 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d914c HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8dd0 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8b04 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d8b14 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8ae8 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e31b8 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004e2980 HYTeris!ATL::CWindowImpl<CTsMainDisplayPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d88c4 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8330 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d88f0 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d88e0 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d8a40 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e30f0 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d8a5c HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d8a6c HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004e21d0 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d8c70 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e2e78 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004e1f00 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> > `RTTI Type Descriptor' = <no type information>
004d9208 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d9218 HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004e1ad8 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d834c HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d835c HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8c9c HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8c8c HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d856c HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d855c HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e2bb8 HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d7fa0 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d7fb0 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d91ec HYTeris!ATL::CWindowImpl<CTsSingleControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e2048 HYTeris!ATL::CWindowImpl<CTsMainButtonPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d8174 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d8184 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Base Class Array' = <no type information>
004d8dfc HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8dec HYTeris!ATL::CWindowImpl<CTsMutiScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e2728 HYTeris!ATL::CWindowImpl<CTsKeyEdit,WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004e28c8 HYTeris!ATL::CWindowImpl<CTsNextElementContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d8fac HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8f9c HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d848c HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8f80 HYTeris!ATL::CWindowImpl<CTsButton,WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8158 HYTeris!ATL::CWindowImpl<CTsGameMainWnd,ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8540 HYTeris!ATL::CWindowImpl<CTsMainStatusPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d7944 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d7f84 HYTeris!ATL::CWindowImpl<CTsDisplayContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e2aa0 HYTeris!ATL::CWindowImpl<CTsSingleScoreContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d9168 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d9178 HYTeris!ATL::CWindowImpl<CTsSubControlContainer,ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004e1628 HYTeris!ATL::CWindowImpl<CTsAgentWindow,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004e2148 HYTeris!ATL::CWindowImpl<CTsMainControlPane,ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d95c4 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Base Class Array' = <no type information>
004d95b4 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e3400 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > `RTTI Type Descriptor' = <no type information>
004d9598 HYTeris!ATL::CWindowImpl<CTsUserListCtrl,WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
위의 기 호 는 우리 의 여러 사례 의 추측 을 검증 할 수 있 습 니 다.CWindowImpl 은 우리 의 창 계승 클래스(T),창 기본 클래스(TBase),창 스타일(TWINTraits)과 관련 이 있어 수량 이 많 습 니 다. 그렇다면 왜 이렇게 많은 기호,즉 이렇게 많은 함수 코드,exe 크기 가 커지 지 않 았 습 니까?그 때 는 CWindowImpl 류 함수 자체 가 매우 작 기 때문에 우 리 는 함수 의 코드 양 에서 알 수 있 었 다.같은 방법 으로 우 리 는 CWindowImplBaseT
template <class TBase = CWindow, class TWinTraits = CControlWinTraits>
class ATL_NO_VTABLE CWindowImplBaseT : public CWindowImplRoot< TBase >
{
public:
WNDPROC m_pfnSuperWindowProc;
CWindowImplBaseT() : m_pfnSuperWindowProc(::DefWindowProc)
{}
static DWORD GetWndStyle(DWORD dwStyle)
{
return TWinTraits::GetWndStyle(dwStyle);
}
static DWORD GetWndExStyle(DWORD dwExStyle)
{
return TWinTraits::GetWndExStyle(dwExStyle);
}
virtual WNDPROC GetWindowProc()
{
return WindowProc;
}
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName,
DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam = NULL);
BOOL DestroyWindow()
{
ATLASSERT(::IsWindow(m_hWnd));
return ::DestroyWindow(m_hWnd);
}
BOOL SubclassWindow(HWND hWnd);
HWND UnsubclassWindow(BOOL bForce = FALSE);
LRESULT DefWindowProc()
{
const _ATL_MSG* pMsg = m_pCurrentMsg;
LRESULT lRes = 0;
if (pMsg != NULL)
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
return lRes;
}
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
#ifdef STRICT
return ::CallWindowProc(m_pfnSuperWindowProc, m_hWnd, uMsg, wParam, lParam);
#else
return ::CallWindowProc((FARPROC)m_pfnSuperWindowProc, m_hWnd, uMsg, wParam, lParam);
#endif
}
virtual void OnFinalMessage(HWND /*hWnd*/)
{
// override to do something, if needed
}
};
0:000> x HYTeris!ATL::CWindowImplBaseT<*
0040f170 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, unsigned short, void *)
0040ec20 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndStyle (unsigned long)
00435970 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::OnFinalMessage (struct HWND__ *)
004604d0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::GetWndStyle (unsigned long)
00434a10 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::~CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
0040ec60 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWndExStyle (unsigned long)
00461740 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::WindowProc (struct HWND__ *, unsigned int, unsigned int, long)
0044c040 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::WindowProc (struct HWND__ *, unsigned int, unsigned int, long)
004346e0 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::~CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
0041c440 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00435940 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::GetWindowProc (void)
00459580 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::GetWndExStyle (unsigned long)
00461950 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, unsigned short, void *)
004395b0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::StartWindowProc (struct HWND__ *, unsigned int, unsigned int, long)
00439ea0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::DefWindowProcW (unsigned int, unsigned int, long)
00461620 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::StartWindowProc (struct HWND__ *, unsigned int, unsigned int, long)
004596e0 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, unsigned short, void *)
0041ced0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::WindowProc (struct HWND__ *, unsigned int, unsigned int, long)
0044c370 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::UnsubclassWindow (int)
00460510 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::GetWndExStyle (unsigned long)
00457f70 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::WindowProc (struct HWND__ *, unsigned int, unsigned int, long)
0045f830 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::GetWindowProc (void)
00457820 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
004374b0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::GetWndExStyle (unsigned long)
00434ad0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::~CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > (void)
004595c0 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::StartWindowProc (struct HWND__ *, unsigned int, unsigned int, long)
004358f0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> > (void)
00445920 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::OnFinalMessage (struct HWND__ *)
00461ad0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::DefWindowProcW (unsigned int, unsigned int, long)
0041c4c0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::OnFinalMessage (struct HWND__ *)
00437470 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::GetWndStyle (unsigned long)
004398e0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::Create (struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, unsigned short, void *)
0040ed50 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::StartWindowProc (struct HWND__ *, unsigned int, unsigned int, long)
004458a0 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > (void)
0045f7e0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > (void)
0041ad30 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::~CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> > (void)
00430550 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::~CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> > (void)
0045f860 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::OnFinalMessage (struct HWND__ *)
004582a0 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::UnsubclassWindow (int)
0041c490 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::GetWindowProc (void)
0044cb50 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::DefWindowProcW (unsigned int, unsigned int, long)
0044c250 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::SubclassWindow (struct HWND__ *)
004458f0 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::GetWindowProc (void)
00459540 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::GetWndStyle (unsigned long)
00458180 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::SubclassWindow (struct HWND__ *)
00457870 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::GetWindowProc (void)
00457910 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::OnFinalMessage (struct HWND__ *)
0040e990 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::DestroyWindow (void)
004396d0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::WindowProc (struct HWND__ *, unsigned int, unsigned int, long)
0041d1c0 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::DefWindowProcW (unsigned int, unsigned int, long)
004578a0 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::DefWindowProcW (unsigned int, unsigned int, long)
004d8fc8 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8ff4 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8fe4 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d79b4 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d79a4 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e2798 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d819c HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d8938 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Array' = <no type information>
004d8928 HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d960c HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Base Class Array' = <no type information>
004d95fc HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e2ee8 HYTeris!ATL::CWindowImplBaseT<WTL::CButtonT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d81c8 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Base Class Array' = <no type information>
004d81b8 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004e34a0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > > `RTTI Type Descriptor' = <no type information>
004d95e0 HYTeris!ATL::CWindowImplBaseT<WTL::CListViewCtrlT<ATL::CWindow>,ATL::CWinTraitsOR<32777,0,ATL::CWinTraits<1442840576,0> > >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e1f68 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<114229248,262400> > `RTTI Type Descriptor' = <no type information>
004e1688 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> > `RTTI Type Descriptor' = <no type information>
004d7988 HYTeris!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d890c HYTeris!ATL::CWindowImplBaseT<WTL::CEditT<ATL::CWindow>,ATL::CWinTraits<1442840576,0> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
를 계속 분석 할 수 있다.CWindowImplBaseT 는 창 기본 클래스 와 창 스타일 만 관련 되 고 수량 이 많이 줄 었 으 며 CWindowImplBaseT 템 플 릿 류 자체 의 함수 수량 이 많 지 않 고 함수 코드 의 크기 도 크 지 않다.그리고 CWindowImplRoot 를 보면
template <class TBase /* = CWindow */>
class ATL_NO_VTABLE CWindowImplRoot : public TBase, public CMessageMap
{
public:
CWndProcThunk m_thunk;
const _ATL_MSG* m_pCurrentMsg;
DWORD m_dwState;
enum { WINSTATE_DESTROYED = 0x00000001 };
// Constructor/destructor
CWindowImplRoot() : m_pCurrentMsg(NULL), m_dwState(0)
{ }
virtual ~CWindowImplRoot()
{
#ifdef _DEBUG
if(m_hWnd != NULL) // should be cleared in WindowProc
{
ATLTRACE(atlTraceWindowing, 0, _T("ERROR - Object deleted before window was destroyed
"));
ATLASSERT(FALSE);
}
#endif //_DEBUG
}
// Current message
const _ATL_MSG* GetCurrentMessage() const
{
return m_pCurrentMsg;
}
// "handled" management for cracked handlers
BOOL IsMsgHandled() const
{
const _ATL_MSG* pMsg = GetCurrentMessage();
ATLASSERT(pMsg != NULL);
ATLASSERT(pMsg->cbSize >= sizeof(_ATL_MSG));
return pMsg->bHandled;
}
void SetMsgHandled(BOOL bHandled)
{
_ATL_MSG* pMsg = (_ATL_MSG*)GetCurrentMessage(); // override const
ATLASSERT(pMsg != NULL);
ATLASSERT(pMsg->cbSize >= sizeof(_ATL_MSG));
pMsg->bHandled = bHandled;
}
// Message forwarding and reflection support
LRESULT ForwardNotifications(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT ReflectNotifications(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
static BOOL DefaultReflectionHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult);
};
0:000> x HYTeris!ATL::CWindowImplRoot*
004364d0 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> >::~CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> > (void)
004367d0 HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> >::~CWindowImplRoot<WTL::CEditT<ATL::CWindow> > (void)
00457c30 HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> >::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> > (void)
00460550 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> >::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> > (void)
004479d0 HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> >::CWindowImplRoot<WTL::CEditT<ATL::CWindow> > (void)
0041c360 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::~CWindowImplRoot<ATL::CWindow> (void)
00435f40 HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> >::~CWindowImplRoot<WTL::CButtonT<ATL::CWindow> > (void)
004613f0 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::ForwardNotifications (unsigned int, unsigned int, long, int *)
00438f50 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::ReflectNotifications (unsigned int, unsigned int, long, int *)
0041c8e0 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::CWindowImplRoot<ATL::CWindow> (void)
004e2800 HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> > `RTTI Type Descriptor' = <no type information>
004d897c HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> >::`RTTI Base Class Array' = <no type information>
004d896c HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d9640 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d9650 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> >::`RTTI Base Class Array' = <no type information>
004d8950 HYTeris!ATL::CWindowImplRoot<WTL::CEditT<ATL::CWindow> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d9028 HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> >::`RTTI Class Hierarchy Descriptor' = <no type information>
004d9038 HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> >::`RTTI Base Class Array' = <no type information>
004e16dc HYTeris!ATL::CWindowImplRoot<ATL::CWindow> `RTTI Type Descriptor' = <no type information>
004e3530 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> > `RTTI Type Descriptor' = <no type information>
004d9624 HYTeris!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d79c8 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004e2f58 HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> > `RTTI Type Descriptor' = <no type information>
004d79f4 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::`RTTI Base Class Array' = <no type information>
004d79e4 HYTeris!ATL::CWindowImplRoot<ATL::CWindow>::`RTTI Class Hierarchy Descriptor' = <no type information>
004d900c HYTeris!ATL::CWindowImplRoot<WTL::CButtonT<ATL::CWindow> >::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
CWindowImplRoot 는 창 기본 클래스(CWindow)와 만 관련 되 기 때문에 관련 기호 가 더욱 적다.마지막 으로 CWindow:
0:000> x HYTeris!ATL::CWindow::*
004e1000 HYTeris!ATL::CWindow::rcDefault = struct tagRECT
00442a20 HYTeris!ATL::CWindow::DestroyWindow (void)
00425730 HYTeris!ATL::CWindow::InvalidateRect (struct tagRECT *, int)
00442340 HYTeris!ATL::CWindow::CenterWindow (struct HWND__ *)
00425850 HYTeris!ATL::CWindow::UpdateWindow (void)
0041c950 HYTeris!ATL::CWindow::CWindow (struct HWND__ *)
004391e0 HYTeris!ATL::CWindow::GetDlgItem (int)
004568a0 HYTeris!ATL::CWindow::SetWindowRgn (struct HRGN__ *, int)
00441d20 HYTeris!ATL::CWindow::GetWindowLongW (int)
00444350 HYTeris!ATL::CWindow::Create (wchar_t *, struct HWND__ *, class ATL::_U_RECT, wchar_t *, unsigned long, unsigned long, class ATL::_U_MENUorID, void *)
004391b0 HYTeris!ATL::CWindow::operator HWND__ * (void)
00459080 HYTeris!ATL::CWindow::EnableWindow (int)
00425140 HYTeris!ATL::CWindow::GetClientRect (struct tagRECT *)
00430c70 HYTeris!ATL::CWindow::SetWindowTextW (wchar_t *)
0040eb30 HYTeris!ATL::CWindow::GetWndClassName (void)
00456770 HYTeris!ATL::CWindow::MoveWindow (int, int, int, int, int)
00442ac0 HYTeris!ATL::CWindow::KillTimer (unsigned int)
00455fc0 HYTeris!ATL::CWindow::GetWindowTextW (wchar_t *, int)
0040ba20 HYTeris!ATL::CWindow::IsWindow (void)
00441db0 HYTeris!ATL::CWindow::GetParent (void)
004315b0 HYTeris!ATL::CWindow::SetWindowPos (struct HWND__ *, int, int, int, int, unsigned int)
00456810 HYTeris!ATL::CWindow::GetWindowRect (struct tagRECT *)
00431860 HYTeris!ATL::CWindow::GetStyle (void)
00455250 HYTeris!ATL::CWindow::Invalidate (int)
004318f0 HYTeris!ATL::CWindow::SetCapture (void)
00442cf0 HYTeris!ATL::CWindow::SetTimer (unsigned int, unsigned int, <function> *)
00431980 HYTeris!ATL::CWindow::ModifyStyle (unsigned long, unsigned long, unsigned int)
00443d10 HYTeris!ATL::CWindow::GetDlgItemTextW (int, wchar_t *, int)
0040b980 HYTeris!ATL::CWindow::SendMessageW (unsigned int, unsigned int, long)
00434be0 HYTeris!ATL::CWindow::ShowWindow (int)
004d7a38 HYTeris!ATL::CWindow::`RTTI Base Class Descriptor at (0,-1,0,64)' = <no type information>
004d7a04 HYTeris!ATL::CWindow::`RTTI Base Class Descriptor at (4,-1,0,64)' = <no type information>
004d7a20 HYTeris!ATL::CWindow::`RTTI Class Hierarchy Descriptor' = <no type information>
004d7a30 HYTeris!ATL::CWindow::`RTTI Base Class Array' = <no type information>
우 리 는 CWindow 가 한 부 밖 에 없 는 것 을 보 았 습 니 다.그리고 함수 수 는 AtlWin.h 에 비해 많이 줄 었 습 니 다.ATL 은 소스 코드 로 제공 되 기 때문에 사용 되 지 않 은 모든 함 수 는 우리 의 최종 실행 가능 한 파일 에 컴 파일 되 지 않 습 니 다.위의 분석 을 통 해 우 리 는 왜 ATL/WTL 이 템 플 릿 을 대량으로 사용 하 는 지 알 게 되 었 다 고 믿 습 니 다.그러나 생 성 된 exe 는 이렇게 작은 원인 입 니 다.템 플 릿 이 코드 를 팽창 시 키 지 않 는 것 이 아니 라 ATL/WTL 이 디자인 할 때 이 문 제 를 주 목 했 습 니 다.많은 템 플 릿 인 스 턴 스 를 생 성 할 수 있 는 템 플 릿 류 에서 대량의 코드 를 작성 하 는 것 을 피 했 습 니 다.
요약 하면 템 플 릿 을 사용 하고 싶 지만 최종 실행 가능 한 파일 을 크게 만 들 고 싶 지 않 습 니 다.두 가지 방식 이 있 습 니 다.(1)템 플 릿 류 는 많은 템 플 릿 인 스 턴 스 를 만 들 지 않 습 니 다.이렇게 템 플 릿 류 로 쓰 는 것 이 의미 가 있 습 니까?(2)템 플 릿 류 의 코드 양 이나 함수 개수 가 적 습 니 다.ATL 방식 을 따라 템 플 릿 과 무관 한 것 을 계승 하 는 방식 으로 층 층 이 분리 하여 템 플 릿 류 의 코드 가 모두 템 플 릿 매개 변수 와 관련 이 있 는 지 확인 할 수 있 습 니 다.