From 60a1e20ba8e5b827a93867b3978efbf0642de4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Tue, 22 Jul 2008 00:18:09 +0200 Subject: [PATCH] comctl32: Don't print ERRs for reflected messages. --- dlls/comctl32/animate.c | 2 +- dlls/comctl32/comboex.c | 2 +- dlls/comctl32/comctl32.h | 1 + dlls/comctl32/commctrl.c | 44 ++++++++++++++++++++++++++++++++++++++ dlls/comctl32/datetime.c | 2 +- dlls/comctl32/flatsb.c | 2 +- dlls/comctl32/header.c | 2 +- dlls/comctl32/hotkey.c | 2 +- dlls/comctl32/ipaddress.c | 2 +- dlls/comctl32/listview.c | 2 +- dlls/comctl32/monthcal.c | 2 +- dlls/comctl32/nativefont.c | 2 +- dlls/comctl32/progress.c | 2 +- dlls/comctl32/rebar.c | 2 +- dlls/comctl32/status.c | 2 +- dlls/comctl32/syslink.c | 2 +- dlls/comctl32/tab.c | 2 +- dlls/comctl32/toolbar.c | 2 +- dlls/comctl32/tooltips.c | 2 +- dlls/comctl32/trackbar.c | 2 +- dlls/comctl32/treeview.c | 2 +- dlls/comctl32/updown.c | 2 +- 22 files changed, 65 insertions(+), 20 deletions(-) diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index a567cb34858..0dd25f8208a 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -962,7 +962,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP return DefWindowProcW(hWnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW(hWnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c index afd4f824d6a..1c9b202aa8f 100644 --- a/dlls/comctl32/comboex.c +++ b/dlls/comctl32/comboex.c @@ -2310,7 +2310,7 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n",uMsg,wParam,lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index da9243f63bc..2c8e53816d6 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -149,6 +149,7 @@ VOID COMCTL32_RefreshSysColors(void); void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal); void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground); void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm); +BOOL COMCTL32_IsReflectedMessage(UINT uMsg); INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen); BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index 1863dbf235c..050a018701f 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -1572,6 +1572,50 @@ void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm) ReleaseDC(NULL, hdc); } +#ifndef OCM__BASE /* avoid including olectl.h */ +#define OCM__BASE (WM_USER+0x1c00) +#endif + +/*********************************************************************** + * COMCTL32_IsReflectedMessage [internal] + * + * Some parents reflect notify messages - for some messages sent by the child, + * they send it back with the message code increased by OCM__BASE (0x2000). + * This allows better subclassing of controls. We don't need to handle such + * messages but we don't want to print ERRs for them, so this helper function + * identifies them. + * + * Some of the codes are in the CCM_FIRST..CCM_LAST range, but there is no + * colision with defined CCM_ codes. + */ +BOOL COMCTL32_IsReflectedMessage(UINT uMsg) +{ + switch (uMsg) + { + case OCM__BASE + WM_COMMAND: + case OCM__BASE + WM_CTLCOLORBTN: + case OCM__BASE + WM_CTLCOLOREDIT: + case OCM__BASE + WM_CTLCOLORDLG: + case OCM__BASE + WM_CTLCOLORLISTBOX: + case OCM__BASE + WM_CTLCOLORMSGBOX: + case OCM__BASE + WM_CTLCOLORSCROLLBAR: + case OCM__BASE + WM_CTLCOLORSTATIC: + case OCM__BASE + WM_DRAWITEM: + case OCM__BASE + WM_MEASUREITEM: + case OCM__BASE + WM_DELETEITEM: + case OCM__BASE + WM_VKEYTOITEM: + case OCM__BASE + WM_CHARTOITEM: + case OCM__BASE + WM_COMPAREITEM: + case OCM__BASE + WM_HSCROLL: + case OCM__BASE + WM_VSCROLL: + case OCM__BASE + WM_PARENTNOTIFY: + case OCM__BASE + WM_NOTIFY: + return TRUE; + default: + return FALSE; + } +} + /*********************************************************************** * MirrorIcon [COMCTL32.414] * diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index b46c4956cb8..e73faf6b5fb 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -1381,7 +1381,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return (LRESULT) infoPtr->hFont; default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/flatsb.c b/dlls/comctl32/flatsb.c index 080aff98e29..cabcdfcb8f4 100644 --- a/dlls/comctl32/flatsb.c +++ b/dlls/comctl32/flatsb.c @@ -257,7 +257,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return FlatSB_Destroy (hwnd, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index 3d1631007f3..496df62b0f4 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -2125,7 +2125,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_SetRedraw(hwnd, wParam, lParam); default: - if ((msg >= WM_USER) && (msg < WM_APP)) + if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", msg, wParam, lParam ); return DefWindowProcW(hwnd, msg, wParam, lParam); diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c index 8a56fd38993..6e7591a509f 100644 --- a/dlls/comctl32/hotkey.c +++ b/dlls/comctl32/hotkey.c @@ -528,7 +528,7 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam)); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index c29406fd186..0c02daf7090 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c @@ -590,7 +590,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return IPADDRESS_IsBlank (infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 6b16a7bbab7..213b5697463 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -10033,7 +10033,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case WM_WININICHANGE: */ default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); fwd_msg: diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index f3d54b182c8..9ca6fcc5e7f 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -2072,7 +2072,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_Destroy(infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR( "unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW(hwnd, uMsg, wParam, lParam); } diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c index a599a2aa984..22bf2dffb4a 100644 --- a/dlls/comctl32/nativefont.c +++ b/dlls/comctl32/nativefont.c @@ -101,7 +101,7 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcW (hwnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c index d3b7ded976c..d29fec5b18d 100644 --- a/dlls/comctl32/progress.c +++ b/dlls/comctl32/progress.c @@ -722,7 +722,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, return infoPtr->Marquee; default: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam ); return DefWindowProcW( hwnd, message, wParam, lParam ); } diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 16f6b9cc239..e2b8c4f44f7 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -3733,7 +3733,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_WindowPosChanged (infoPtr, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index 45615eb8e15..f96d2b90a1f 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -1346,7 +1346,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return theme_changed (infoPtr); default: - if ((msg >= WM_USER) && (msg < WM_APP)) + if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", msg, wParam, lParam); return DefWindowProcW (hwnd, msg, wParam, lParam); diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index a1b8aff1e3f..a78a00c60b7 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -1750,7 +1750,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, default: HandleDefaultMessage: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) { ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam ); } diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 62047e5a08f..725cc103f84 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -3269,7 +3269,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TAB_NCCalcSize(hwnd, wParam, lParam); default: - if (uMsg >= WM_USER && uMsg < WM_APP) + if (uMsg >= WM_USER && uMsg < WM_APP && !COMCTL32_IsReflectedMessage(uMsg)) WARN("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); break; diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index bd37e193aab..15e65b3497a 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -7046,7 +7046,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcW (hwnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 5368835c476..f7e538b0f01 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -2843,7 +2843,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLTIPS_WinIniChange (hwnd, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c index 67cf32d4f40..d540f005669 100644 --- a/dlls/comctl32/trackbar.c +++ b/dlls/comctl32/trackbar.c @@ -1911,7 +1911,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRACKBAR_InitializeThumb (infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index f2f0eb91890..51e11bfe3ba 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -5705,7 +5705,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) default: /* This mostly catches MFC and Delphi messages. :( */ - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) TRACE("Unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); def: return DefWindowProcW(hwnd, uMsg, wParam, lParam); diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index a62e22134bd..a971afa1c46 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -1082,7 +1082,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L return temp; default: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam); return DefWindowProcW (hwnd, message, wParam, lParam); }