Read windows titlebar color

Is it possible to get the (user set) windows titlebar color?

About the only way is with declares, but if you use GraffitiSuite then I have GraffitiColors which provides a massive amount of system color functionality.

Specifically, GraffitiColors.Windows.BackgroundWindowCaptionActive and GraffitiColors.Windows.BackgroundWindowCaptionInactive.

To further specify, for the old color values in Win32 you want to use the GetSysColor API.

Thanks. The correct term is accent color. The COLOR class provides a lot of system color, but not this one unfortunately.

Ah, if you want the new color listings, I make those available in GraffitiColors.Windows.Immersive.

Found it. Easy without declares:

[code]
'read reg key
Var ColorReg As New RegistryItem(“HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM”, False)

Var lines() As String

'hop over values an store in array
For i As Integer = 0 To ColorReg.KeyCount - 1
Var name As String = ColorReg.Name(i)
Var value As Variant = ColorReg.Value(i)
lines.AddRow(name + " -> " + value)
Next

'display
Var s As String
s= String.FromArray(Lines, EndOfLine)

MessageBox(s)[/code]

The 9th (8) value is AccentColor

I seem to recall there being some caveats to getting it from the registry based on the Windows build, but I don’t have specifics. Either way, glad you’ve found a solution that works for you.

[quote=485895:@Alexander van der Linden]Found it. Easy without declares:

[code]
'read reg key
Var ColorReg As New RegistryItem(“HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM”, False)

Var lines() As String

'hop over values an store in array
For i As Integer = 0 To ColorReg.KeyCount - 1
Var name As String = ColorReg.Name(i)
Var value As Variant = ColorReg.Value(i)
lines.AddRow(name + " -> " + value)
Next

'display
Var s As String
s= String.FromArray(Lines, EndOfLine)

MessageBox(s)[/code]

The 9th (8) value is AccentColor[/quote]
If the user’s settings is to follow what’s shown on the screen (I don’t have a Windows VM to grab the exact wordings; I’m talking about the option where the titlebar changes according to the user’s wallpaper and possibly other UI things), would the registry always update in real time?

As soon as the user changes the accent color in the config screen the new setting is written to the registry. I have verified this, though I have some difficulties to translate the setting to a correct Xojo color as sometimes the colorcode is a negative integer.

I’m not sure I was clear…

In the Windows’ settings, there’s a checkbox to have the active colour be set accordingly to the background wallpaper; if your wallpaper changes every 5 minutes, the active colour may change (this is not the user changing the colour, at this point). Would the actual colour be written to the registry, or a value indicating it’s “random”?

I don’t know. Seems easy to verify.

I’ll see eventually, when I launch my Windows VM…