mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 20:06:40 +00:00
[ATL] atlwin.h: Formatting, and add a comment in IsParentDialog().
This commit is contained in:
parent
fcc222c28a
commit
e60a4f00b5
1 changed files with 120 additions and 116 deletions
|
@ -60,7 +60,6 @@ namespace ATL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct _ATL_WNDCLASSINFOW;
|
struct _ATL_WNDCLASSINFOW;
|
||||||
typedef _ATL_WNDCLASSINFOW CWndClassInfo;
|
typedef _ATL_WNDCLASSINFOW CWndClassInfo;
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ struct thunkCode
|
||||||
m_mov = 0x042444C7;
|
m_mov = 0x042444C7;
|
||||||
m_this = PtrToUlong(pThis);
|
m_this = PtrToUlong(pThis);
|
||||||
m_jmp = 0xe9;
|
m_jmp = 0xe9;
|
||||||
m_relproc = DWORD(reinterpret_cast<char *>(proc) - (reinterpret_cast<char *>(this) + sizeof(thunkCode)));
|
m_relproc = DWORD(reinterpret_cast<char*>(proc) - (reinterpret_cast<char*>(this) + sizeof(thunkCode)));
|
||||||
FlushInstructionCache(GetCurrentProcess(), this, sizeof(thunkCode));
|
FlushInstructionCache(GetCurrentProcess(), this, sizeof(thunkCode));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -229,8 +228,8 @@ class CWndProcThunk
|
||||||
public:
|
public:
|
||||||
thunkCode *m_pthunk;
|
thunkCode *m_pthunk;
|
||||||
_AtlCreateWndData cd;
|
_AtlCreateWndData cd;
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
CWndProcThunk()
|
CWndProcThunk()
|
||||||
{
|
{
|
||||||
m_pthunk = (thunkCode*)VirtualAlloc(NULL, sizeof(thunkCode), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
m_pthunk = (thunkCode*)VirtualAlloc(NULL, sizeof(thunkCode), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
|
@ -267,6 +266,7 @@ class CWindow
|
||||||
public:
|
public:
|
||||||
HWND m_hWnd;
|
HWND m_hWnd;
|
||||||
static RECT rcDefault;
|
static RECT rcDefault;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWindow(HWND hWnd = NULL)
|
CWindow(HWND hWnd = NULL)
|
||||||
{
|
{
|
||||||
|
@ -873,8 +873,8 @@ public:
|
||||||
BOOL IsParentDialog()
|
BOOL IsParentDialog()
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsWindow(m_hWnd));
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
TCHAR pszType[10];
|
TCHAR pszType[10]; // Use sizeof("#32770")+3 so that extra characters can be detected.
|
||||||
if (!RealGetWindowClass(::GetParent(m_hWnd), pszType, sizeof(pszType) / sizeof(pszType[0])))
|
if (!RealGetWindowClass(::GetParent(m_hWnd), pszType, _countof(pszType)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return !_tcscmp(pszType, _T("#32770"));
|
return !_tcscmp(pszType, _T("#32770"));
|
||||||
}
|
}
|
||||||
|
@ -1345,7 +1345,7 @@ public:
|
||||||
|
|
||||||
static INT_PTR CALLBACK StartDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK StartDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CDialogImplBaseT<TBase> *pThis;
|
CDialogImplBaseT<TBase>* pThis;
|
||||||
DLGPROC newDlgProc;
|
DLGPROC newDlgProc;
|
||||||
DLGPROC GCCU(pOldProc);
|
DLGPROC GCCU(pOldProc);
|
||||||
|
|
||||||
|
@ -1353,6 +1353,7 @@ public:
|
||||||
ATLASSERT(pThis != NULL);
|
ATLASSERT(pThis != NULL);
|
||||||
if (pThis == NULL)
|
if (pThis == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pThis->m_thunk.Init((WNDPROC)pThis->GetDialogProc(), pThis);
|
pThis->m_thunk.Init((WNDPROC)pThis->GetDialogProc(), pThis);
|
||||||
newDlgProc = reinterpret_cast<DLGPROC>(pThis->m_thunk.GetWNDPROC());
|
newDlgProc = reinterpret_cast<DLGPROC>(pThis->m_thunk.GetWNDPROC());
|
||||||
pOldProc = reinterpret_cast<DLGPROC>(::SetWindowLongPtr(hWnd, DWLP_DLGPROC, reinterpret_cast<LONG_PTR>(newDlgProc)));
|
pOldProc = reinterpret_cast<DLGPROC>(::SetWindowLongPtr(hWnd, DWLP_DLGPROC, reinterpret_cast<LONG_PTR>(newDlgProc)));
|
||||||
|
@ -1363,7 +1364,7 @@ public:
|
||||||
|
|
||||||
static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CDialogImplBaseT<TBase> *pThis = reinterpret_cast<CDialogImplBaseT<TBase>*>(hWnd);
|
CDialogImplBaseT<TBase>* pThis = reinterpret_cast<CDialogImplBaseT<TBase>*>(hWnd);
|
||||||
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
||||||
LRESULT lResult = 0;
|
LRESULT lResult = 0;
|
||||||
const _ATL_MSG *previousMessage;
|
const _ATL_MSG *previousMessage;
|
||||||
|
@ -1410,7 +1411,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
template <class T, class TBase = CWindow>
|
template <class T, class TBase = CWindow>
|
||||||
class CDialogImpl : public CDialogImplBaseT< TBase >
|
class CDialogImpl : public CDialogImplBaseT<TBase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// + Hacks for gcc
|
// + Hacks for gcc
|
||||||
|
@ -1488,7 +1489,7 @@ public:
|
||||||
ATLASSERT(m_hWnd == NULL);
|
ATLASSERT(m_hWnd == NULL);
|
||||||
ATLASSERT(::IsWindow(hWnd));
|
ATLASSERT(::IsWindow(hWnd));
|
||||||
|
|
||||||
CWindowImplBaseT<TBase, TWinTraits> *pThis;
|
CWindowImplBaseT<TBase, TWinTraits>* pThis;
|
||||||
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
|
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
|
||||||
|
|
||||||
BOOL result = m_thunk.Init(GetWindowProc(), this);
|
BOOL result = m_thunk.Init(GetWindowProc(), this);
|
||||||
|
@ -1545,22 +1546,22 @@ public:
|
||||||
|
|
||||||
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CWindowImplBaseT<TBase, TWinTraits> *pThis;
|
CWindowImplBaseT<TBase, TWinTraits>* pThis;
|
||||||
|
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(this);
|
||||||
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(this);
|
|
||||||
return ::CallWindowProc(m_pfnSuperWindowProc, pThis->m_hWnd, uMsg, wParam, lParam);
|
return ::CallWindowProc(m_pfnSuperWindowProc, pThis->m_hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CWindowImplBaseT<TBase, TWinTraits> *pThis;
|
CWindowImplBaseT<TBase, TWinTraits>* pThis;
|
||||||
WNDPROC newWindowProc;
|
WNDPROC newWindowProc;
|
||||||
WNDPROC GCCU(pOldProc);
|
WNDPROC GCCU(pOldProc);
|
||||||
|
|
||||||
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(_AtlWinModule.ExtractCreateWndData());
|
pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits>*>(_AtlWinModule.ExtractCreateWndData());
|
||||||
ATLASSERT(pThis != NULL);
|
ATLASSERT(pThis != NULL);
|
||||||
if (pThis == NULL)
|
if (pThis == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
|
pThis->m_thunk.Init(pThis->GetWindowProc(), pThis);
|
||||||
newWindowProc = pThis->m_thunk.GetWNDPROC();
|
newWindowProc = pThis->m_thunk.GetWNDPROC();
|
||||||
pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
|
pOldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(newWindowProc)));
|
||||||
|
@ -1571,7 +1572,7 @@ public:
|
||||||
|
|
||||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CWindowImplBaseT<TBase, TWinTraits> *pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits> *>(hWnd);
|
CWindowImplBaseT<TBase, TWinTraits>* pThis = reinterpret_cast<CWindowImplBaseT< TBase, TWinTraits>*>(hWnd);
|
||||||
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
const _ATL_MSG *previousMessage;
|
const _ATL_MSG *previousMessage;
|
||||||
|
@ -1605,7 +1606,9 @@ public:
|
||||||
pThis->m_dwState |= WINSTATE_DESTROYED;
|
pThis->m_dwState |= WINSTATE_DESTROYED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
|
lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ATLASSERT(pThis->m_pCurrentMsg == &msg);
|
ATLASSERT(pThis->m_pCurrentMsg == &msg);
|
||||||
pThis->m_pCurrentMsg = previousMessage;
|
pThis->m_pCurrentMsg = previousMessage;
|
||||||
|
@ -1619,9 +1622,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle,
|
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle,
|
||||||
_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
|
_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
|
||||||
{
|
{
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
|
||||||
ATLASSERT(m_hWnd == NULL);
|
ATLASSERT(m_hWnd == NULL);
|
||||||
ATLASSERT(atom != 0);
|
ATLASSERT(atom != 0);
|
||||||
|
@ -1638,6 +1641,7 @@ public:
|
||||||
MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
|
MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this;
|
||||||
if (rect.m_lpRect == NULL)
|
if (rect.m_lpRect == NULL)
|
||||||
rect.m_lpRect = &TBase::rcDefault;
|
rect.m_lpRect = &TBase::rcDefault;
|
||||||
|
|
||||||
hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
|
hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left,
|
||||||
rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
|
rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top,
|
||||||
hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
|
hWndParent, MenuOrID.m_hMenu, _AtlBaseModule.GetModuleInstance(), lpCreateParam);
|
||||||
|
@ -1657,16 +1661,15 @@ public:
|
||||||
using CWindowImplRoot<TBase>::m_hWnd;
|
using CWindowImplRoot<TBase>::m_hWnd;
|
||||||
// - Hacks for gcc
|
// - Hacks for gcc
|
||||||
|
|
||||||
|
|
||||||
static LPCTSTR GetWndCaption()
|
static LPCTSTR GetWndCaption()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND Create(HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0,
|
HWND Create(HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0,
|
||||||
DWORD dwExStyle = 0, _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
|
DWORD dwExStyle = 0, _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)
|
||||||
{
|
{
|
||||||
CWindowImplBaseT<TBase, TWinTraits> *pThis;
|
CWindowImplBaseT<TBase, TWinTraits>* pThis;
|
||||||
ATOM atom;
|
ATOM atom;
|
||||||
|
|
||||||
ATLASSERT(m_hWnd == NULL);
|
ATLASSERT(m_hWnd == NULL);
|
||||||
|
@ -1700,6 +1703,7 @@ public:
|
||||||
CMessageMap *m_pObject;
|
CMessageMap *m_pObject;
|
||||||
DWORD m_dwMsgMapID;
|
DWORD m_dwMsgMapID;
|
||||||
const _ATL_MSG *m_pCurrentMsg;
|
const _ATL_MSG *m_pCurrentMsg;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CContainedWindowT(CMessageMap *pObject, DWORD dwMsgMapID = 0)
|
CContainedWindowT(CMessageMap *pObject, DWORD dwMsgMapID = 0)
|
||||||
{
|
{
|
||||||
|
@ -1729,8 +1733,8 @@ public:
|
||||||
ATLASSERT(m_hWnd == NULL);
|
ATLASSERT(m_hWnd == NULL);
|
||||||
ATLASSERT(::IsWindow(hWnd));
|
ATLASSERT(::IsWindow(hWnd));
|
||||||
|
|
||||||
CContainedWindowT<TBase> *pThis;
|
CContainedWindowT<TBase>* pThis;
|
||||||
pThis = reinterpret_cast<CContainedWindowT<TBase> *>(this);
|
pThis = reinterpret_cast<CContainedWindowT<TBase>*>(this);
|
||||||
|
|
||||||
BOOL result = m_thunk.Init(WindowProc, pThis);
|
BOOL result = m_thunk.Init(WindowProc, pThis);
|
||||||
if (result == FALSE)
|
if (result == FALSE)
|
||||||
|
@ -1770,11 +1774,11 @@ public:
|
||||||
|
|
||||||
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CContainedWindowT<TBase> *pThis;
|
CContainedWindowT<TBase>* pThis;
|
||||||
WNDPROC newWindowProc;
|
WNDPROC newWindowProc;
|
||||||
WNDPROC GCCU(pOldProc);
|
WNDPROC GCCU(pOldProc);
|
||||||
|
|
||||||
pThis = reinterpret_cast<CContainedWindowT<TBase> *>(_AtlWinModule.ExtractCreateWndData());
|
pThis = reinterpret_cast<CContainedWindowT<TBase>*>(_AtlWinModule.ExtractCreateWndData());
|
||||||
ATLASSERT(pThis != NULL);
|
ATLASSERT(pThis != NULL);
|
||||||
if (pThis == NULL)
|
if (pThis == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1788,7 +1792,7 @@ public:
|
||||||
|
|
||||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CContainedWindowT<TBase> *pThis = reinterpret_cast<CContainedWindowT<TBase> *>(hWnd);
|
CContainedWindowT<TBase>* pThis = reinterpret_cast<CContainedWindowT<TBase>*>(hWnd);
|
||||||
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
const _ATL_MSG *previousMessage;
|
const _ATL_MSG *previousMessage;
|
||||||
|
@ -1826,122 +1830,122 @@ public:
|
||||||
};
|
};
|
||||||
typedef CContainedWindowT<CWindow> CContainedWindow;
|
typedef CContainedWindowT<CWindow> CContainedWindow;
|
||||||
|
|
||||||
#define BEGIN_MSG_MAP(theClass) \
|
#define BEGIN_MSG_MAP(theClass) \
|
||||||
public: \
|
public: \
|
||||||
BOOL ProcessWindowMessage(HWND GCCU(hWnd), UINT GCCU(uMsg), WPARAM GCCU(wParam), LPARAM GCCU(lParam), LRESULT &GCCU(lResult), DWORD dwMsgMapID = 0) \
|
BOOL ProcessWindowMessage(HWND GCCU(hWnd), UINT GCCU(uMsg), WPARAM GCCU(wParam), LPARAM GCCU(lParam), LRESULT &GCCU(lResult), DWORD dwMsgMapID = 0) \
|
||||||
{ \
|
{ \
|
||||||
BOOL GCCU(bHandled) = TRUE; \
|
BOOL GCCU(bHandled) = TRUE; \
|
||||||
Unused(hWnd); \
|
Unused(hWnd); \
|
||||||
Unused(uMsg); \
|
Unused(uMsg); \
|
||||||
Unused(wParam); \
|
Unused(wParam); \
|
||||||
Unused(lParam); \
|
Unused(lParam); \
|
||||||
Unused(lResult); \
|
Unused(lResult); \
|
||||||
Unused(bHandled); \
|
Unused(bHandled); \
|
||||||
switch(dwMsgMapID) \
|
switch(dwMsgMapID) \
|
||||||
{ \
|
{ \
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
#define ALT_MSG_MAP(map) \
|
#define ALT_MSG_MAP(map) \
|
||||||
break; \
|
break; \
|
||||||
case map:
|
case map:
|
||||||
|
|
||||||
#define END_MSG_MAP() \
|
#define END_MSG_MAP() \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
ATLASSERT(FALSE); \
|
ATLASSERT(FALSE); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MESSAGE_HANDLER(msg, func) \
|
#define MESSAGE_HANDLER(msg, func) \
|
||||||
if (uMsg == msg) \
|
if (uMsg == msg) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(uMsg, wParam, lParam, bHandled); \
|
lResult = func(uMsg, wParam, lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MESSAGE_RANGE_HANDLER(msgFirst, msgLast, func) \
|
#define MESSAGE_RANGE_HANDLER(msgFirst, msgLast, func) \
|
||||||
if (uMsg >= msgFirst && uMsg <= msgLast) \
|
if (uMsg >= msgFirst && uMsg <= msgLast) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(uMsg, wParam, lParam, bHandled); \
|
lResult = func(uMsg, wParam, lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMMAND_HANDLER(id, code, func) \
|
#define COMMAND_HANDLER(id, code, func) \
|
||||||
if (uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
if (uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMMAND_ID_HANDLER(id, func) \
|
#define COMMAND_ID_HANDLER(id, func) \
|
||||||
if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMMAND_CODE_HANDLER(code, func) \
|
#define COMMAND_CODE_HANDLER(code, func) \
|
||||||
if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
|
#define COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
|
||||||
if (uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
if (uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOTIFY_CODE_HANDLER(cd, func) \
|
#define NOTIFY_CODE_HANDLER(cd, func) \
|
||||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NOTIFY_HANDLER(id, cd, func) \
|
#define NOTIFY_HANDLER(id, cd, func) \
|
||||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
||||||
if (bHandled) \
|
if (bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHAIN_MSG_MAP(theChainClass) \
|
#define CHAIN_MSG_MAP(theChainClass) \
|
||||||
{ \
|
{ \
|
||||||
if (theChainClass::ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult)) \
|
if (theChainClass::ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult)) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \
|
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \
|
||||||
static ATL::CWndClassInfo& GetWndClassInfo() \
|
static ATL::CWndClassInfo& GetWndClassInfo() \
|
||||||
{ \
|
{ \
|
||||||
static ATL::CWndClassInfo wc = \
|
static ATL::CWndClassInfo wc = \
|
||||||
{ \
|
{ \
|
||||||
{ sizeof(WNDCLASSEX), style, StartWindowProc, \
|
{ sizeof(WNDCLASSEX), style, StartWindowProc, \
|
||||||
0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \
|
0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \
|
||||||
NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \
|
NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \
|
||||||
}; \
|
}; \
|
||||||
return wc; \
|
return wc; \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct _ATL_WNDCLASSINFOW
|
struct _ATL_WNDCLASSINFOW
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue