0

I'm trying to get a brush with the system color of an active window, or this blue color off my Windows 8.1 for example:

enter image description here

So I do this:

HANDLE hBrush = GetSysColorBrush(COLOR_ACTIVECAPTION);

But the color that brush gives me is this:

enter image description here

Any idea what am I doing wrong here?

c00000fd
  • 20,994
  • 29
  • 177
  • 400
  • `GetThemeSysColorBrush`, and in general look at Visual Styles API – Igor Tandetnik Aug 01 '15 at 04:50
  • @IgorTandetnik: Thanks. But what am I supposed to pass as the 1st parameter, or `hTheme`? If I pass `NULL` then it returns NULL as well. – c00000fd Aug 01 '15 at 05:10
  • @DavidHeffernan: Hmm, guys. I'm not sure I understand how it works. I just tried `OpenThemeData(hWnd, L"window");` and then `TMT_ACTIVECAPTION` for `iColorID` but it gave me just a gray color. Moreover none of other flags gave me this expected blue as I showed above. – c00000fd Aug 01 '15 at 05:43
  • Try `L"Globals"` and also read AeroStyle.xml as per docs – David Heffernan Aug 01 '15 at 05:53
  • I don't think any theme handles will get GetThemeSysColorBrush to return sensible values. Only GetThemeSysColor seems to work. – Angus Johnson Apr 22 '18 at 13:10

2 Answers2

0

You could try with "0xA" or "COLOR_ACTIVEBORDER" as documented in GetSysColor Function at MSND: GetSysColor Function

HANDLE hBrush = GetSysColorBrush(COLOR_ACTIVEBORDER);
0

Supposedly, DwmGetColorizationColor return this color value.

On Windows 7/Vista, it sounds like the situation was much more complicated due to the glass translucency effects: Vista/7: How to get glass color?

Since you're dealing with Windows 8.1, transparency is disabled, so this should provide the opaque color for the Window.

Community
  • 1
  • 1
Ryand
  • 436
  • 4
  • 16