I cobbled together a little macro to process the WM_CTLCOLOREDIT message only for a particular control ID:
// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit)
#define MSG_WM_CTLCOLOREDITEX(id, func) \
if (uMsg == WM_CTLCOLOREDIT) \
{ \
HWND hWnd = (HWND)lParam; \
int ctrlID = NULL; \
ATLASSERT(::IsWindow(hWnd)); \
if (::IsWindow(hWnd)) \
{ \
ATLASSERT(!::GetDlgCtrlID((HWND)lParam)); \
if ((ctrlID = ::GetDlgCtrlID((HWND)lParam))) \
{ \
if (id == ctrlID) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
} \
} \
} \
}
Unfortunately, this macro was a waste of time. The function "func" should simply call SetMsgHandled(FALSE) in order to pass MSG_WM_CTLCOLOREDIT to following handlers.