comctl32/toolbar: Potential fix for button redraw in TBSTYLE_FLAT toolbars

Andrew de Quincey adq_dvb at lidskialf.net
Thu Dec 11 17:00:47 CST 2003


On Thursday 11 December 2003 22:45, Dimitrie O. Paun wrote:
> On December 11, 2003 04:32 pm, Andrew de Quincey wrote:
> > I have concluded that the WM_ERASEBKGND is sent from within WM_PAINT when
> > the toolbar detects that the mouse has moved off a button and wants to
> > de-highlight it.
>
> Well, it probably does a InvalidateRect() call. You can try an ugly
>     InvaldateRect(hwnd, 0, TRUE);
> but this will probably result in flicker. For added bonus, figure out
> the button's rect, and pass it in:
>
>     /* figure out stuff in rect */
>     InvalidateRect(hwnd, &rect, TRUE);

Actually, that code is almost already in there... it does call 
InvalidateRect() already, but passes FALSE because TOOLBAR_HasText() returns 
false. This happens in the TOOLBAR_MouseMove() function. 

Originally, I had decided that this wasn't what windows does because in spyxx, 
the WM_ERASEBKGND occurs AFTER the WM_PAINT. 

However, I now see I have misread MSDN: The call to BeginPaint() inside the 
WM_PAINT issues the WM_ERASEBKGND because bErase was TRUE, so it would 
obviously occur after the WM_PAINT. This sounds much nicer.

> BTW, what are the parameters of WM_ERASEBKGND?

wParam == device context handle
lParam == unused



More information about the wine-devel mailing list