How do I get the text color for the taskbar clock?

  • Thread starter Thread starter Quoner
  • Start date Start date
Q

Quoner

With XP's default theme (Windows XP style / Default (blue) on the Display
Properties/Appearance tab), the taskbar clock foreground color is white.
Change that to Windows XP style / Olive Green, and that taskbar clock
foreground changes to black.

So my question is, how do I get that color programmatically?

Thanks!
 
Hi,

Do you have any information that this color is at all stored anywhere? I
just think the system might check whether the taskbar background is light or
dark and choose the appropriate clock foreground color.
 
Hmm....that's an interesting point. But then, how does one determine the
taskbar background color?

Thanks.

Dmitriy Lapshin said:
Hi,

Do you have any information that this color is at all stored anywhere? I
just think the system might check whether the taskbar background is light
or dark and choose the appropriate clock foreground color.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Quoner said:
With XP's default theme (Windows XP style / Default (blue) on the Display
Properties/Appearance tab), the taskbar clock foreground color is white.
Change that to Windows XP style / Olive Green, and that taskbar clock
foreground changes to black.

So my question is, how do I get that color programmatically?

Thanks!
 
So my question is, how do I get that color programmatically?

I think you can use OpenThemeData("Clock") followed by
GetThemeColor(CLP_TIME, TMT_TEXTCOLOR). The taskbar clock itself
simply uses The DrawThemeText API. If Visual Styles are disables, you
can fall back on the button text color.


http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/functions/openthemedata.asp
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/functions/getthemecolor.asp



Mattias
 
Thanks for the reply.

Sorry to be such a newbie, but these are the calls I'm now trying:

HTHEME hTheme = OpenThemeData(HWND_DESKTOP, L"Clock");
GetThemeColor(hTheme, CLP_TIME, CLS_NORMAL, TMT_TEXTCOLOR, &color);

But that first call returns NULL for the hTheme. The same call works for,
say, L"Button", but not for L"Clock". Is that first parameter, HWND_DESKTOP,
incorrect, and if so, what is the correct parameter?

Thanks again.
 
Is that first parameter, HWND_DESKTOP,
incorrect, and if so, what is the correct parameter?

Don't you have your own window handle you can pass in? HWND_DESKTOP is
a pseudo handle for use with the MapWindowPoints function.



Mattias
 
Back
Top