user32: Add a rudimentary WM_SETFONT message test for the static control, make it pass under Wine

Alexandre Julliard julliard at winehq.org
Tue Nov 21 04:58:35 CST 2006


Dmitry Timoshkov <dmitry at codeweavers.com> writes:

> @@ -496,7 +504,10 @@ static LRESULT StaticWndProc_common( HWN
>          {
>              SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, wParam );
>              if (LOWORD(lParam))
> -                STATIC_TryPaintFcn( hwnd, full_style );
> +            {
> +                InvalidateRect( hwnd, NULL, TRUE );
> +                UpdateWindow( hwnd );
> +            }

A single RedrawWindow call would be more efficient.

> @@ -673,9 +684,7 @@ static void STATIC_PaintTextfn( HWND hwn
>          if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
>      }
>  
> -    if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return;
> -    if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return;
> -    SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text );
> +    if (!(len = InternalGetWindowText( hwnd, text, sizeof(text)/sizeof(WCHAR) ))) return;

You are introducing a hard-coded limit to the length of the text,
that's not a good idea.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list