It seems like there is an awful lot going on "under the covers" with the Theme functions (OpenThemeData, GetWindowTheme, etc.) that is not documented, but that we really need to know. Or am I misunderstanding things?
First thing I noticed: the OpenThemeData() function says it "Opens the theme data for a window", but if you call GetWindowTheme() before and after the call to OpenThemeData() you will see that as an undocumented side-effect, OpenThemeData() assigns the theme
to the window. That's not surprising, but would be nice if it was explicit.
Second: if you call OpenThemeData() multiple times with similar windows and identical classes, you get the same handle each time. How many times do I then need to call CloseThemeData()? Is there reference counting going on here? When OpenThemeData()
assigns the theme to the window, does that increment the reference count?
Is there a better reference on all this that someone can recommend?