WM_CTLCOLOR.. will be sent to parent window. [?? Probable Spam]

Dmitry Timoshkov dmitry at baikal.ru
Thu Jan 22 02:19:06 CST 2004


<taro-x at justsystem.co.jp> wrote:

> @@ -2665,12 +2665,27 @@
>  static LRESULT
>  TREEVIEW_EraseBackground(TREEVIEW_INFO *infoPtr, HDC hDC)
>  {
> -    HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
> -    RECT rect;
> +    HBRUSH hBrushLocal = NULL;
> +    HWND hwnd = infoPtr->hwnd;
> +    HBRUSH hBrush = (HBRUSH)SendMessageW(GetParent(hwnd),
> +        IsWindowEnabled(hwnd) ? WM_CTLCOLOREDIT : WM_CTLCOLORSTATIC,
> +    (WPARAM)hDC, (LPARAM)hwnd);
> +    if (!hBrush)
> +    {
> + hBrushLocal = CreateSolidBrush(GetBkColor(hDC));
> + hBrush = hBrushLocal;
> +    }

1. treeview has hwndNotify for sending notification messages, WM_CTLxxx messages
can be sent to it as well.

2. In the case SendMessage(WM_CTLxxx) returns 0 (i.e. an app doesn't call DefWindowProc)
you have to call DefWindowProc(WM_CTLxxx) yourself and not create an arbitrary brush.

3. Do not use C++ style comments.

-- 
Dmitry.






More information about the wine-devel mailing list