ReactOS  0.4.12-dev-18-gf469aca
ATL::CWindowImplBaseT< TBase, TWinTraits > Class Template Reference

#include <atlwin.h>

Inheritance diagram for ATL::CWindowImplBaseT< TBase, TWinTraits >:
Collaboration diagram for ATL::CWindowImplBaseT< TBase, TWinTraits >:

Public Member Functions

 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (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)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< TBase >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CMessageMap
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 

Static Public Member Functions

static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Public Attributes

WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< TBase >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< TBase >
enum  { WINSTATE_DESTROYED = 0x00000001 }
 

Detailed Description

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
class ATL::CWindowImplBaseT< TBase, TWinTraits >

Definition at line 1453 of file atlwin.h.

Constructor & Destructor Documentation

◆ CWindowImplBaseT()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
ATL::CWindowImplBaseT< TBase, TWinTraits >::CWindowImplBaseT ( )
inline

Definition at line 1464 of file atlwin.h.

1465  {
1467  }
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1512
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1461

Member Function Documentation

◆ Create()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
HWND ATL::CWindowImplBaseT< TBase, TWinTraits >::Create ( HWND  hWndParent,
_U_RECT  rect,
LPCTSTR  szWindowName,
DWORD  dwStyle,
DWORD  dwExStyle,
_U_MENUorID  MenuOrID,
ATOM  atom,
LPVOID  lpCreateParam 
)
inline

Definition at line 1582 of file atlwin.h.

Referenced by ATL::CWindowImpl< CShellBrowser, CWindow, CFrameWinTraits >::Create().

1584  {
1585  HWND hWnd;
1586 
1587  ATLASSERT(m_hWnd == NULL);
1588  ATLASSERT(atom != 0);
1589  if (atom == 0)
1590  return NULL;
1591  if (m_thunk.Init(NULL, NULL) == FALSE)
1592  {
1594  return NULL;
1595  }
1596 
1598  if (MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD) != 0)
1599  MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
1600  if (rect.m_lpRect == NULL)
1601  rect.m_lpRect = &TBase::rcDefault;
1602  hWnd = ::CreateWindowEx(dwExStyle, reinterpret_cast<LPCWSTR>(MAKEINTATOM(atom)), szWindowName, dwStyle, rect.m_lpRect->left,
1603  rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
1604  hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
1605 
1606  ATLASSERT(m_hWnd == hWnd);
1607 
1608  return hWnd;
1609  }
HINSTANCE GetModuleInstance()
Definition: atlcore.h:198
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void AddCreateWndData(_AtlCreateWndData *pData, void *pObject)
Definition: atlbase.h:986
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
_AtlCreateWndData cd
Definition: atlwin.h:222
& rect
Definition: startmenu.cpp:1413
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:236
#define CreateWindowEx
Definition: winuser.h:5621
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:409
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
CAtlWinModule _AtlWinModule
Definition: atlbase.cpp:27
CWndProcThunk m_thunk
Definition: atlwin.h:1302
CAtlBaseModule _AtlBaseModule
Definition: atlbase.cpp:26
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define MAKEINTATOM(i)
Definition: winbase.h:1416
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

◆ DefWindowProc()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
LRESULT ATL::CWindowImplBaseT< TBase, TWinTraits >::DefWindowProc ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inline

Definition at line 1512 of file atlwin.h.

Referenced by CShellBrowser::WindowProc(), and ATL::CWindowImplBaseT< CToolbar< TASK_ITEM >, CControlWinTraits >::WindowProc().

1513  {
1514  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1515 
1516  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(this);
1518  }
#define CallWindowProc
Definition: winuser.h:5601
WPARAM wParam
Definition: combotst.c:138
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1461
LPARAM lParam
Definition: combotst.c:139

◆ GetWindowProc()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
virtual WNDPROC ATL::CWindowImplBaseT< TBase, TWinTraits >::GetWindowProc ( )
inlinevirtual

Reimplemented in CShellBrowser, and CDefView.

Definition at line 1497 of file atlwin.h.

Referenced by ATL::CWindowImplBaseT< CToolbar< TASK_ITEM >, CControlWinTraits >::StartWindowProc().

1498  {
1499  return WindowProc;
1500  }
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1538

◆ GetWndExStyle()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
static DWORD ATL::CWindowImplBaseT< TBase, TWinTraits >::GetWndExStyle ( DWORD  dwExStyle)
inlinestatic

Definition at line 1507 of file atlwin.h.

1508  {
1509  return TWinTraits::GetWndExStyle(dwExStyle);
1510  }

◆ GetWndStyle()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
static DWORD ATL::CWindowImplBaseT< TBase, TWinTraits >::GetWndStyle ( DWORD  dwStyle)
inlinestatic

Definition at line 1502 of file atlwin.h.

1503  {
1504  return TWinTraits::GetWndStyle(dwStyle);
1505  }

◆ OnFinalMessage()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
virtual void ATL::CWindowImplBaseT< TBase, TWinTraits >::OnFinalMessage ( HWND  )
inlinevirtual

◆ StartWindowProc()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
static LRESULT CALLBACK ATL::CWindowImplBaseT< TBase, TWinTraits >::StartWindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inlinestatic

Definition at line 1520 of file atlwin.h.

1521  {
1522  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1523  WNDPROC newWindowProc;
1524  WNDPROC GCCU(pOldProc);
1525 
1526  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(_AtlWinModule.ExtractCreateWndData());
1527  ATLASSERT(pThis != NULL);
1528  if (pThis == NULL)
1529  return 0;
1530  pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
1531  newWindowProc = pThis->m_thunk.GetWNDPROC();
1532  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1533  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1534  pThis->m_hWnd = hWnd;
1535  return newWindowProc(hWnd, uMsg, wParam, lParam);
1536  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HWND hWnd
Definition: settings.c:17
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
CAtlWinModule _AtlWinModule
Definition: atlbase.cpp:27
void * ExtractCreateWndData()
Definition: atlbase.h:991
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define GCCU(x)
Definition: atlwin.h:27
LPARAM lParam
Definition: combotst.c:139
#define Unused(x)
Definition: atlwin.h:28

◆ SubclassWindow()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
BOOL ATL::CWindowImplBaseT< TBase, TWinTraits >::SubclassWindow ( HWND  hWnd)
inline

Definition at line 1473 of file atlwin.h.

1474  {
1475  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1476  WNDPROC newWindowProc;
1477  WNDPROC oldWindowProc;
1478  BOOL result;
1479 
1480  ATLASSERT(m_hWnd == NULL);
1481  ATLASSERT(::IsWindow(hWnd));
1482 
1483  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1484 
1485  result = m_thunk.Init(GetWindowProc(), this);
1486  if (result == FALSE)
1487  return FALSE;
1488  newWindowProc = m_thunk.GetWNDPROC();
1489  oldWindowProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1490  if (oldWindowProc == NULL)
1491  return FALSE;
1492  m_pfnSuperWindowProc = oldWindowProc;
1493  pThis->m_hWnd = hWnd;
1494  return TRUE;
1495  }
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HWND hWnd
Definition: settings.c:17
WNDPROC GetWNDPROC()
Definition: atlwin.h:244
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:236
smooth NULL
Definition: ftsmooth.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual WNDPROC GetWindowProc()
Definition: atlwin.h:1497
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
CWndProcThunk m_thunk
Definition: atlwin.h:1302
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1461
GLuint64EXT * result
Definition: glext.h:11304

◆ WindowProc()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
static LRESULT CALLBACK ATL::CWindowImplBaseT< TBase, TWinTraits >::WindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inlinestatic

Definition at line 1538 of file atlwin.h.

1539  {
1540  CWindowImplBaseT<TBase, TWinTraits> *pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits> *>(hWnd);
1541  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1542  LRESULT lResult;
1543  const _ATL_MSG *previousMessage;
1544  BOOL handled;
1545  LONG_PTR saveWindowProc;
1546 
1547  ATLASSERT(pThis != NULL && (pThis->m_dwState & WINSTATE_DESTROYED) == 0 && pThis->m_hWnd != NULL);
1548  if (pThis == NULL || (pThis->m_dwState & WINSTATE_DESTROYED) != 0 || pThis->m_hWnd == NULL)
1549  return 0;
1550 
1551  hWnd = pThis->m_hWnd;
1552  previousMessage = pThis->m_pCurrentMsg;
1553  pThis->m_pCurrentMsg = &msg;
1554 
1555  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1556  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1557 
1558  if (handled == FALSE)
1559  {
1560  if (uMsg == WM_NCDESTROY)
1561  {
1562  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1563  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1564  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1565  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1566  pThis->m_dwState |= WINSTATE_DESTROYED;
1567  }
1568  else
1569  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1570  }
1571  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1572  pThis->m_pCurrentMsg = previousMessage;
1573  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1574  {
1575  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1576  pThis->m_hWnd = NULL;
1577  pThis->OnFinalMessage(hWnd);
1578  }
1579  return lResult;
1580  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HWND hWnd
Definition: settings.c:17
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1512
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_NCDESTROY
Definition: winuser.h:1666
#define GWLP_WNDPROC
Definition: treelist.c:66
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
#define GetWindowLongPtr
Definition: treelist.c:73
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Member Data Documentation

◆ m_pfnSuperWindowProc

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
WNDPROC ATL::CWindowImplBaseT< TBase, TWinTraits >::m_pfnSuperWindowProc

The documentation for this class was generated from the following file: