Jump to content

desktop bg color as bg color in gui


mscrx
 Share

Recommended Posts

I tried to get the value of the background color from [HKEY_CURRENT_USER\Control Panel\Colors] Background"="58 110 165"

but when I use this value 58110165 as bg color for the gui it wont be the same color as it is on the desktop. I assume this is because the desktop color is being calculated by 3 other factors (hue, sat, lum). is it possible to get the correct value for the color somewhere else so that the gui has the same color?

Link to comment
Share on other sites

I assume this is because the desktop color is being calculated by 3 other factors (hue, sat, lum).

No, it's because that registry entry is a string which contains 3 decimal values, each representing R G and B, separated by spaces.

While the value used in ...SetColor functions is a composition of these values in hexadecimal, in form of 0x00RRGGBB.

Anyway, you don't need registry for that.

$aRet = DllCall('user32.dll', 'int', 'GetSysColor', 'int', 1) ;1 = COLOR_DESKTOP
GUISetBkColor(RGB2BGR($aRet[0]))

Func RGB2BGR($iColor)
    Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF)
EndFunc
Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...