ReactOS  0.4.15-dev-4603-gb922b6d
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 1497 of file atlwin.h.

Constructor & Destructor Documentation

◆ CWindowImplBaseT()

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

Definition at line 1509 of file atlwin.h.

1510  {
1512  }
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1578
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1506

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

1657  {
1658  HWND hWnd;
1659 
1660  ATLASSERT(m_hWnd == NULL);
1661  ATLASSERT(atom != 0);
1662  if (atom == 0)
1663  return NULL;
1664  if (m_thunk.Init(NULL, NULL) == FALSE)
1665  {
1667  return NULL;
1668  }
1669 
1670  _AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
1671  if (MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD) != 0)
1672  MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
1673  if (rect.m_lpRect == NULL)
1674  rect.m_lpRect = &TBase::rcDefault;
1675 
1676  hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
1677  rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
1678  hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
1679 
1680  ATLASSERT(m_hWnd == hWnd);
1681 
1682  return hWnd;
1683  }
#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:5735
#define SetLastError(x)
Definition: compat.h:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
CWndProcThunk m_thunk
Definition: atlwin.h:1345
#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 1578 of file atlwin.h.

1579  {
1580  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1581  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1583  }
#define CallWindowProc
Definition: winuser.h:5715
WPARAM wParam
Definition: combotst.c:138
WNDPROC m_pfnSuperWindowProc
Definition: atlwin.h:1506
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 1563 of file atlwin.h.

1564  {
1565  return WindowProc;
1566  }
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1604

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

1574  {
1575  return TWinTraits::GetWndExStyle(dwExStyle);
1576  }

◆ GetWndStyle()

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

Definition at line 1568 of file atlwin.h.

1569  {
1570  return TWinTraits::GetWndStyle(dwStyle);
1571  }

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

1586  {
1587  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1588  WNDPROC newWindowProc;
1589  WNDPROC GCCU(pOldProc);
1590 
1591  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(_AtlWinModule.ExtractCreateWndData());
1592  ATLASSERT(pThis != NULL);
1593  if (pThis == NULL)
1594  return 0;
1595 
1596  pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
1597  newWindowProc = pThis->m_thunk.GetWNDPROC();
1598  pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1599  Unused(pOldProc); // TODO: should generate trace message if overwriting another subclass
1600  pThis->m_hWnd = hWnd;
1601  return newWindowProc(hWnd, uMsg, wParam, lParam);
1602  }
#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:2886
#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 1518 of file atlwin.h.

1519  {
1520  ATLASSERT(m_hWnd == NULL);
1521  ATLASSERT(::IsWindow(hWnd));
1522 
1523  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1524  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1525 
1526  BOOL result = m_thunk.Init(GetWindowProc(), this);
1527  if (result == FALSE)
1528  return FALSE;
1529 
1530  WNDPROC newWindowProc = m_thunk.GetWNDPROC();
1531  WNDPROC oldWindowProc = reinterpret_cast<WNDPROC>(
1532  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
1533  if (oldWindowProc == NULL)
1534  return FALSE;
1535 
1536  pThis->m_pfnSuperWindowProc = oldWindowProc;
1537  pThis->m_hWnd = hWnd;
1538  return TRUE;
1539  }
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:1563
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
CWndProcThunk m_thunk
Definition: atlwin.h:1345
#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 1541 of file atlwin.h.

1542  {
1543  ATLASSERT(m_hWnd != NULL);
1544  ATLASSERT(::IsWindow(m_hWnd));
1545 
1546  CWindowImplBaseT<TBase, TWinTraits>* pThis;
1547  pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
1548 
1549  HWND hwndOld = pThis->m_hWnd;
1550  WNDPROC oldWindowProc = m_thunk.GetWNDPROC();
1551  WNDPROC subclassedProc = reinterpret_cast<WNDPROC>(
1552  ::GetWindowLongPtr(hwndOld, GWLP_WNDPROC));
1553  if (!bForce && oldWindowProc != subclassedProc)
1554  return NULL;
1555 
1557  (LONG_PTR)pThis->m_pfnSuperWindowProc);
1558  pThis->m_pfnSuperWindowProc = ::DefWindowProc;
1559  pThis->m_hWnd = NULL;
1560  return hwndOld;
1561  }
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:1578
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
CWndProcThunk m_thunk
Definition: atlwin.h:1345
__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 1604 of file atlwin.h.

1605  {
1606  CWindowImplBaseT<TBase, TWinTraits>* pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits>*>(hWnd);
1607  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1608  LRESULT lResult;
1609  const _ATL_MSG *previousMessage;
1610  BOOL handled;
1611  LONG_PTR saveWindowProc;
1612 
1613  ATLASSERT(pThis != NULL);
1614  if (pThis == NULL)
1615  return 0;
1616 
1617  ATLASSERT((pThis->m_dwState & WINSTATE_DESTROYED) == 0);
1618  ATLASSERT(pThis->m_hWnd != NULL);
1619  if ((pThis->m_dwState & WINSTATE_DESTROYED) != 0 || pThis->m_hWnd == NULL)
1620  return 0;
1621 
1622  hWnd = pThis->m_hWnd;
1623  previousMessage = pThis->m_pCurrentMsg;
1624  pThis->m_pCurrentMsg = &msg;
1625 
1626  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1627  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1628 
1629  if (handled == FALSE)
1630  {
1631  if (uMsg == WM_NCDESTROY)
1632  {
1633  saveWindowProc = ::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
1634  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1635  if (pThis->m_pfnSuperWindowProc != ::DefWindowProc && saveWindowProc == ::GetWindowLongPtr(hWnd, GWLP_WNDPROC))
1636  ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pThis->m_pfnSuperWindowProc));
1637  pThis->m_dwState |= WINSTATE_DESTROYED;
1638  }
1639  else
1640  {
1641  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1642  }
1643  }
1644  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1645  pThis->m_pCurrentMsg = previousMessage;
1646  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1647  {
1648  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1649  pThis->m_hWnd = NULL;
1650  pThis->OnFinalMessage(hWnd);
1651  }
1652  return lResult;
1653  }
#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:1578
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_NCDESTROY
Definition: winuser.h:1671
#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: