From: Mark Harmstone Subject: [PATCH] comctl32: Handle BM_SETSTATE sent to themed buttons. Message-Id: <551AF95F.8040006@burntcomma.com> Date: Tue, 31 Mar 2015 20:45:35 +0100 This patch changes comctl32 to handle BM_SETSTATE itself when sent to a themed button, rather than forwarding it to user32. This way, the theming isn't temporarily lost when user32 repaints it. --- dlls/comctl32/theme_button.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c index bdeba93..8ba684a 100644 --- a/dlls/comctl32/theme_button.c +++ b/dlls/comctl32/theme_button.c @@ -417,6 +417,18 @@ LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg, break; } + case BM_SETSTATE: + { + int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0); + if (wParam) + SetWindowLongW(hwnd, 0, state | BST_PUSHED); + else + SetWindowLongW(hwnd, 0, state & ~BST_PUSHED); + + InvalidateRect(hwnd, NULL, FALSE); + break; + } + default: /* Call old proc */ return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);