RE: Fix toolbar get style

2004-04-30 Thread Maxime Bellengé
On Fri, 2004-04-30 at 11:28, Ge van Geldorp wrote:
> > From: Maxime BellengÃ
> > 
> > When a toolbar receives a TB_GETSTYLE message with wParam=0, 
> > the application expects to get the toolbar style and not the 
> > first button style. This patch fixes eMule 0.42e, now the 
> > toolbar is visible.
> > 
> > ChangeLog
> >* Fix TB_GETSTYLE to return the style of the toolbar when 
> > wParam is 0
> 
> It seems there is another problem with the toolbar styles. When you 
> CreateToolbarEx() with the WS_VISIBLE bit turned on, TOOLBAR_Create() will call 
> GetWindowLongW() to get the window style and store that as the dwStyle member of 
> TOOLBAR_INFO. Unfortunately, when the WM_CREATE message is sent the WS_VISIBLE bit 
> of the window style retrieved with GetWindowLongW() is always turned off. It is 
> turned on a little bit later, but no WS_STYLECHANGED is sent for this. So, the 
> dwStyle member of TOOLBAR_INFO doesn't always mimick the "true" window style, it is 
> possible that the WS_VISIBLE bit is off in TOOLBAR_INFO but on in the window style. 
> If your app does something like:
> 
> SendMessage(hwndTB, TB_SETSTYLE, 0,
> SendMessage(hwndTB, TB_GETSTYLE, 0, 0) | TBSTYLE_FLAT );
> 
> this will make your toolbar invisible.
> 
> GÃ van Geldorp.
> 

The app is doing something similar but I don't think it is the same
problem.

SendMessage(hwndTB, TB_SETSTYLE, 0, SendMessage(hwndTB, TB_GETSTYLE, 0,
0) & ~ TBSTYLE_LIST);

But this is not done in the WM_CREATE message.

After investigation, the toolbar is not invisible, it has a size of
(0,26) which of course makes it invisible. The problem was that the
style return was the style of a separator button and so the style of the
toolbar was totally false. 

I will try to fix both problems.

Max

-- 
Maxime Bellengà <[EMAIL PROTECTED]>




RE: Fix toolbar get style

2004-04-30 Thread Ge van Geldorp
> From: Maxime BellengÃ
> 
> When a toolbar receives a TB_GETSTYLE message with wParam=0, 
> the application expects to get the toolbar style and not the 
> first button style. This patch fixes eMule 0.42e, now the 
> toolbar is visible.
> 
> ChangeLog
>* Fix TB_GETSTYLE to return the style of the toolbar when 
> wParam is 0

It seems there is another problem with the toolbar styles. When you CreateToolbarEx() 
with the WS_VISIBLE bit turned on, TOOLBAR_Create() will call GetWindowLongW() to get 
the window style and store that as the dwStyle member of TOOLBAR_INFO. Unfortunately, 
when the WM_CREATE message is sent the WS_VISIBLE bit of the window style retrieved 
with GetWindowLongW() is always turned off. It is turned on a little bit later, but no 
WS_STYLECHANGED is sent for this. So, the dwStyle member of TOOLBAR_INFO doesn't 
always mimick the "true" window style, it is possible that the WS_VISIBLE bit is off 
in TOOLBAR_INFO but on in the window style. If your app does something like:

SendMessage(hwndTB, TB_SETSTYLE, 0,
SendMessage(hwndTB, TB_GETSTYLE, 0, 0) | TBSTYLE_FLAT );

this will make your toolbar invisible.

GÃ van Geldorp.





Re: Fix toolbar get style

2004-04-30 Thread [EMAIL PROTECTED]
> >>> [EMAIL PROTECTED] 04/29/04 22:59 PM >>>
> > When a toolbar receives a TB_GETSTYLE message with
wParam=0, the
> > application expects to get the toolbar style and not the
first button
> > style. This patch fixes eMule 0.42e, now the toolbar is
visible.
> > 
> > ChangeLog
> >* Fix TB_GETSTYLE to return the style of the toolbar
when wParam is 0
> 
> Good catch, but I think the original author of the
> TB_GETSTYLE code got a bit confused. I think it should
> always return the style of the toolbar (according to
> MSDN) and should print an ERR or FIXME if wParam != 0,
> as it is reserved.
> Could you resubmit with that change?
> 
> Rob
> 

Hello

I will perform some tests under win xp to check this behaviour
because even if the author may have been confused. I think it
is worth testing that.

I will then send another patch.

a+

Max


Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)







Re: Fix toolbar get style

2004-04-29 Thread Robert Shearman
>>> [EMAIL PROTECTED] 04/29/04 22:59 PM >>>
> When a toolbar receives a TB_GETSTYLE message with wParam=0, the
> application expects to get the toolbar style and not the first button
> style. This patch fixes eMule 0.42e, now the toolbar is visible.
> 
> ChangeLog
>* Fix TB_GETSTYLE to return the style of the toolbar when wParam is 0

Good catch, but I think the original author of the
TB_GETSTYLE code got a bit confused. I think it should
always return the style of the toolbar (according to
MSDN) and should print an ERR or FIXME if wParam != 0,
as it is reserved.
Could you resubmit with that change?

Rob