ReactOS  0.4.15-dev-5097-g328cc41
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 1525 of file atlwin.h.

Constructor & Destructor Documentation

◆ CWindowImplBaseT()

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

Definition at line 1537 of file atlwin.h.

1538  {
1540  }
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1606
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1534

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

1685  {
1686  HWND hWnd;
1687 
1688  ATLASSERT(m_hWnd == NULL);
1689  ATLASSERT(atom != 0);
1690  if (atom == 0)
1691  return NULL;
1692  if (m_thunk.Init(NULL, NULL) == FALSE)
1693  {
1695  return NULL;
1696  }
1697 
1698  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1699  if (MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD) != 0)
1700  MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
1701  if (rect.m_lpRect == NULL)
1702  rect.m_lpRect = &TBase::rcDefault;
1703 
1704  hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
1705  rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
1706  hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
1707 
1708  ATLASSERT(m_hWnd == hWnd);
1709 
1710  return hWnd;
1711  }
#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:230
& rect
Definition: startmenu.cpp:1413
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:244
#define FALSE
Definition: types.h:117
#define CreateWindowEx
Definition: winuser.h:5745
#define SetLastError(x)
Definition: compat.h:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
CWndProcThunk m_thunk
Definition: atlwin.h:1373
#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:1448
#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 1606 of file atlwin.h.

1607  {
1608  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1609  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1611  }
#define CallWindowProc
Definition: winuser.h:5725
WPARAM wParam
Definition: combotst.c:138
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1534
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 1591 of file atlwin.h.

1592  {
1593  return WindowProc;
1594  }
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1632

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

1602  {
1603  return TWinTraits::GetWndExStyle(dwExStyle);
1604  }

◆ GetWndStyle()

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

Definition at line 1596 of file atlwin.h.

1597  {
1598  return TWinTraits::GetWndStyle(dwStyle);
1599  }

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

1614  {
1615  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1616  WNDPROC newWindowProc;
1617  WNDPROC GCCU(pOldProc);
1618 
1619  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(_AtlWinModule.ExtractCreateWndData());
1620  ATLASSERT(pThis != NULL);
1621  if (pThis == NULL)
1622  return 0;
1623 
1624  pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
1625  newWindowProc = pThis->m_thunk.GetWNDPROC();
1626  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1627  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1628  pThis->m_hWnd = hWnd;
1629  return newWindowProc(hWnd, uMsg, wParam, lParam);
1630  }
#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:2896
#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 1546 of file atlwin.h.

1547  {
1548  ATLASSERT(m_hWnd == NULL);
1549  ATLASSERT(::IsWindow(hWnd));
1550 
1551  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1552  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1553 
1554  BOOL result = m_thunk.Init(GetWindowProc(), this);
1555  if (result == FALSE)
1556  return FALSE;
1557 
1558  WNDPROC newWindowProc = m_thunk.GetWNDPROC();
1559  WNDPROC oldWindowProc = reinterpret_cast<WNDPROC>(
1560  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1561  if (oldWindowProc == NULL)
1562  return FALSE;
1563 
1564  pThis->m_pfnSuperWindowProc = oldWindowProc;
1565  pThis->m_hWnd = hWnd;
1566  return TRUE;
1567  }
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:252
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:244
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual WNDPROC GetWindowProc()
Definition: atlwin.h:1591
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
CWndProcThunk m_thunk
Definition: atlwin.h:1373
#define NULL
Definition: types.h:112

Referenced by CreateNotificationBroker(), and CDownloadManager::DownloadDlgProc().

◆ UnsubclassWindow()

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

Definition at line 1569 of file atlwin.h.

1570  {
1571  ATLASSERT(m_hWnd != NULL);
1572  ATLASSERT(::IsWindow(m_hWnd));
1573 
1574  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1575  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1576 
1577  HWND hwndOld = pThis->m_hWnd;
1578  WNDPROC oldWindowProc = m_thunk.GetWNDPROC();
1579  WNDPROC subclassedProc = reinterpret_cast<WNDPROC>(
1580  ::GetWindowLongPtr(hwndOld, GWLP_WNDPROC));
1581  if (!bForce && oldWindowProc != subclassedProc)
1582  return NULL;
1583 
1585  (LONG_PTR)pThis->m_pfnSuperWindowProc);
1586  pThis->m_pfnSuperWindowProc = ::DefWindowProc;
1587  pThis->m_hWnd = NULL;
1588  return hwndOld;
1589  }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
WNDPROC GetWNDPROC()
Definition: atlwin.h:252
#define SetWindowLongPtr
Definition: treelist.c:70
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1606
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
CWndProcThunk m_thunk
Definition: atlwin.h:1373
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by CDownloadManager::DownloadDlgProc().

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

1633  {
1634  CWindowImplBaseT<TBase, TWinTraits>* pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits>*>(hWnd);
1635  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1636  LRESULT lResult;
1637  const _ATL_MSG *previousMessage;
1638  BOOL handled;
1639  LONG_PTR saveWindowProc;
1640 
1641  ATLASSERT(pThis != NULL);
1642  if (pThis == NULL)
1643  return 0;
1644 
1645  ATLASSERT((pThis->m_dwState & WINSTATE_DESTROYED) == 0);
1646  ATLASSERT(pThis->m_hWnd != NULL);
1647  if ((pThis->m_dwState & WINSTATE_DESTROYED) != 0 || pThis->m_hWnd == NULL)
1648  return 0;
1649 
1650  hWnd = pThis->m_hWnd;
1651  previousMessage = pThis->m_pCurrentMsg;
1652  pThis->m_pCurrentMsg = &msg;
1653 
1654  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1655  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1656 
1657  if (handled == FALSE)
1658  {
1659  if (uMsg == WM_NCDESTROY)
1660  {
1661  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1662  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1663  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1664  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1665  pThis->m_dwState |= WINSTATE_DESTROYED;
1666  }
1667  else
1668  {
1669  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1670  }
1671  }
1672  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1673  pThis->m_pCurrentMsg = previousMessage;
1674  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1675  {
1676  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1677  pThis->m_hWnd = NULL;
1678  pThis->OnFinalMessage(hWnd);
1679  }
1680  return lResult;
1681  }
#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:1606
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_NCDESTROY
Definition: winuser.h:1674
#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: