I am trying to retrieve the background and text color of the taskbar and/or my applications main window. It turned out, that Windows 7 does not return the correct colors. If i i.e. switch to a pink theme, Windows 7 still returns light blue for window caption although thats not true. This happens using
GetSysColor(COLOR_ACTIVECAPTION);
as well as using HTHEME hTheme = OpenThemeData(hwnd, L"WINDOW");
HRESULT result = GetThemeColor(
hTheme,
WP_CAPTION,
CS_ACTIVE,
TMT_FILLCOLORHINT,
&color);
Moreover i find myself trying various combinations of parameters to find out the color of the caption text. I know microsofts pages
Property Identifiers and Parts and States
but most combination of these hundreds of parameters are invalid. Is there any list and/or description which combinations can be used?
I.e.
GetThemeColor(
hTheme,
WP_CAPTION, // BP_PUSHBUTTON,
CS_ACTIVE,
TMT_CAPTIONTEXT,
&color);
returns "Element not found".
According to my knowledge of XP themes, an .msstyles file is just a collection of parts definitions that have images and properties (colors, sizes, fonts, etc), all arbitrarily defined. The UxTheme API just returns whatever is in this file, and the presence of a certain combination of properties depends on the theme author, basically (which is why you should always fall back to "classic" GetSysColor
, GetSystemMetrics
or SystemParametersInfo
if the theme API fails to return whatever you are looking for.
However, you mention a "pink theme" here, so I assume you are speaking of an Aero Glass theme. Aero theme colors are handled by the DWM and are yet separate from the classic or UxTheme API colors. In order to retrieve the Aero window color, you must use DwmGetColorizationColor
, which will return it in 0xAARRGGBB format (as opposed to a COLORREF
which is 0x00BBGGRR, so you will need to translate between the two formats). In order to first find if DWM composition (aka "Aero Glass") is enabled, you must call DwmIsCompositionEnabled
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With