ReactOS  0.4.15-dev-2343-ge044df8
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)
 
HWND UnsubclassWindow (BOOL bForce=FALSE)
 
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 1465 of file atlwin.h.

Constructor & Destructor Documentation

◆ CWindowImplBaseT()

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

Definition at line 1477 of file atlwin.h.

1478  {
1480  }
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1546
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1474

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 1621 of file atlwin.h.

1623  {
1624  HWND hWnd;
1625 
1626  ATLASSERT(m_hWnd == NULL);
1627  ATLASSERT(atom != 0);
1628  if (atom == 0)
1629  return NULL;
1630  if (m_thunk.Init(NULL, NULL) == FALSE)
1631  {
1633  return NULL;
1634  }
1635 
1636  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1637  if (MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD) != 0)
1638  MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
1639  if (rect.m_lpRect == NULL)
1640  rect.m_lpRect = &TBase::rcDefault;
1641  hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
1642  rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
1643  hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
1644 
1645  ATLASSERT(m_hWnd == hWnd);
1646 
1647  return hWnd;
1648  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
_AtlCreateWndData cd
Definition: atlwin.h:231
& rect
Definition: startmenu.cpp:1413
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:245
#define FALSE
Definition: types.h:117
#define CreateWindowEx
Definition: winuser.h:5730
#define SetLastError(x)
Definition: compat.h:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
CWndProcThunk m_thunk
Definition: atlwin.h:1314
#define NULL
Definition: types.h:112
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:1445
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

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

◆ DefWindowProc()

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

Definition at line 1546 of file atlwin.h.

1547  {
1548  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1549 
1550  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(this);
1552  }
#define CallWindowProc
Definition: winuser.h:5710
WPARAM wParam
Definition: combotst.c:138
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1474
LPARAM lParam
Definition: combotst.c:139

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

◆ GetWindowProc()

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

Reimplemented in CShellBrowser, and CDefView.

Definition at line 1531 of file atlwin.h.

1532  {
1533  return WindowProc;
1534  }
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1572

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

◆ GetWndExStyle()

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

Definition at line 1541 of file atlwin.h.

1542  {
1543  return TWinTraits::GetWndExStyle(dwExStyle);
1544  }

◆ GetWndStyle()

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

Definition at line 1536 of file atlwin.h.

1537  {
1538  return TWinTraits::GetWndStyle(dwStyle);
1539  }

◆ 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 1554 of file atlwin.h.

1555  {
1556  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1557  WNDPROC newWindowProc;
1558  WNDPROC GCCU(pOldProc);
1559 
1560  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(_AtlWinModule.ExtractCreateWndData());
1561  ATLASSERT(pThis != NULL);
1562  if (pThis == NULL)
1563  return 0;
1564  pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
1565  newWindowProc = pThis->m_thunk.GetWNDPROC();
1566  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1567  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1568  pThis->m_hWnd = hWnd;
1569  return newWindowProc(hWnd, uMsg, wParam, lParam);
1570  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HWND hWnd
Definition: settings.c:17
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define GCCU(x)
Definition: atlwin.h:27
#define NULL
Definition: types.h:112
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 1486 of file atlwin.h.

1487  {
1488  ATLASSERT(m_hWnd == NULL);
1489  ATLASSERT(::IsWindow(hWnd));
1490 
1491  CWindowImplBaseT<TBase, TWinTraits> *pThis;
1492  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1493 
1494  BOOL result = m_thunk.Init(GetWindowProc(), this);
1495  if (result == FALSE)
1496  return FALSE;
1497 
1498  WNDPROC newWindowProc = m_thunk.GetWNDPROC();
1499  WNDPROC oldWindowProc = reinterpret_cast<WNDPROC>(
1500  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1501  if (oldWindowProc == NULL)
1502  return FALSE;
1503 
1504  pThis->m_pfnSuperWindowProc = oldWindowProc;
1505  pThis->m_hWnd = hWnd;
1506  return TRUE;
1507  }
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
WNDPROC GetWNDPROC()
Definition: atlwin.h:253
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:245
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual WNDPROC GetWindowProc()
Definition: atlwin.h:1531
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
CWndProcThunk m_thunk
Definition: atlwin.h:1314
#define NULL
Definition: types.h:112

Referenced by CDownloadManager::DownloadDlgProc().

◆ UnsubclassWindow()

template<class TBase = CWindow, class TWinTraits = CControlWinTraits>
HWND ATL::CWindowImplBaseT< TBase, TWinTraits >::UnsubclassWindow ( BOOL  bForce = FALSE)
inline

Definition at line 1509 of file atlwin.h.

1510  {
1511  ATLASSERT(m_hWnd != NULL);
1512  ATLASSERT(::IsWindow(m_hWnd));
1513 
1514  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1515  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1516 
1517  HWND hwndOld = pThis->m_hWnd;
1518  WNDPROC oldWindowProc = m_thunk.GetWNDPROC();
1519  WNDPROC subclassedProc = reinterpret_cast<WNDPROC>(
1520  ::GetWindowLongPtr(hwndOld, GWLP_WNDPROC));
1521  if (!bForce && oldWindowProc != subclassedProc)
1522  return NULL;
1523 
1525  (LONG_PTR)pThis->m_pfnSuperWindowProc);
1526  pThis->m_pfnSuperWindowProc = ::DefWindowProc;
1527  pThis->m_hWnd = NULL;
1528  return hwndOld;
1529  }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
WNDPROC GetWNDPROC()
Definition: atlwin.h:253
#define SetWindowLongPtr
Definition: treelist.c:70
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1546
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
CWndProcThunk m_thunk
Definition: atlwin.h:1314
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define GetWindowLongPtr
Definition: treelist.c:73

◆ 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 1572 of file atlwin.h.

1573  {
1574  CWindowImplBaseT<TBase, TWinTraits> *pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits> *>(hWnd);
1575  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1576  LRESULT lResult;
1577  const _ATL_MSG *previousMessage;
1578  BOOL handled;
1579  LONG_PTR saveWindowProc;
1580 
1581  ATLASSERT(pThis != NULL);
1582  if (pThis == NULL)
1583  return 0;
1584 
1585  ATLASSERT((pThis->m_dwState & WINSTATE_DESTROYED) == 0);
1586  ATLASSERT(pThis->m_hWnd != NULL);
1587  if ((pThis->m_dwState & WINSTATE_DESTROYED) != 0 || pThis->m_hWnd == NULL)
1588  return 0;
1589 
1590  hWnd = pThis->m_hWnd;
1591  previousMessage = pThis->m_pCurrentMsg;
1592  pThis->m_pCurrentMsg = &msg;
1593 
1594  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1595  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1596 
1597  if (handled == FALSE)
1598  {
1599  if (uMsg == WM_NCDESTROY)
1600  {
1601  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1602  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1603  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1604  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1605  pThis->m_dwState |= WINSTATE_DESTROYED;
1606  }
1607  else
1608  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1609  }
1610  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1611  pThis->m_pCurrentMsg = previousMessage;
1612  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1613  {
1614  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1615  pThis->m_hWnd = NULL;
1616  pThis->OnFinalMessage(hWnd);
1617  }
1618  return lResult;
1619  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
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:1546
#define FALSE
Definition: types.h:117
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 NULL
Definition: types.h:112
#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

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

Member Data Documentation

◆ m_pfnSuperWindowProc


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