Re: Owner Draw STATIC Window with XP Themes
From: Jeff Partch (jeffp_at_mvps.org)
Date: 11/11/04
- Next message: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Previous message: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- In reply to: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Next in thread: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Reply: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 11 Nov 2004 11:29:11 -0600
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:eYX5C%23AyEHA.1984@TK2MSFTNGP14.phx.gbl...
> > FYI, According to Dave Anderson, Microsoft Developer Support, you can't
> > really do this, Doug...
> >
> > "
> > > You should open a theme once per window... open it when the window is
> > > created and close the handle when the window is destroyed. There is a
> > limit
> > > of 64K handles per process. The bug is when this limit is reached,
> > > OpenThemeData does not return NULL.
> > "
> >
> > Even allowing an exception for WM_THEMECHANGED, you're now doing it
twice
> > per window. :)
>
> Well, that answers a question I was wondering about: whether it is okay to
> open the theme data everytime you are redrawing the window. I've seen that
> done many times in code I've seen on the Web. Apparently, it is better to
> open it only once (even though opening it each time seems to work just
> fine).
I've not investigated the veracity of what Dave said in his post, but
inasmuch as the documentation is so poor and the whole scheme so buggy, I
tend to take anything an MS representative says about working with the theme
API seriously enough. I also can't imagine that what he says to do is the
same thing as saying OpenThemeData as much as you want as long as you match
it with a CloseThemeData.
>
> But I might be with Doug here. You must get new theme data in order to
react
> to a theme change, don't you? And Doug is closing the original theme
before
> opening a new one. It seems to me he is following Dave's advice as closely
> as is practical.
Well, why it violates Dave's 'rule' is that the button WNDCLASS calls
OpenThemeData when it gets WM_CREATE and Doug does it again in
PreSubclassWindow, and then in response to WM_THEMECHANGED it's the same
thing -- the button does it and then the subclass does it again. In either
event, that's twice per window, and once per subclass is not the same thing
as once per window. Now extrapolate it to a subclass of a subclass (of a
subclass...), and you can at least imagine why it might not be such a good
practice.
:)
-- Jeff Partch [VC++ MVP]
- Next message: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Previous message: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- In reply to: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Next in thread: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Reply: Jonathan Wood: "Re: Owner Draw STATIC Window with XP Themes"
- Messages sorted by: [ date ] [ thread ]