Jump to content
Sign in to follow this  
JohnnyThrash

Dynamically Changing Vista's Glass Color?

Recommended Posts

JohnnyThrash

I frankly don't know where to start. I've done some searching on google, msdn, and here, but I don't really know what to look for or if it exists. Vista users are probably familiar with the feature of being able to change the color of vista's "glass". I don't want to use automation, that would be my last resort. Is there a dll in windows containing a function to change vista's glass color? I figured it would be relating to the DWM, so i had search that on MSDN as well with no luck. Anybody have any clues?

Share this post


Link to post
Share on other sites
JRowe
Richard Robertson

The "Set" version isn't documented, so you have to make the assumption that Microsoft didn't intend it to be called and as such, may be changed at any time.

Share this post


Link to post
Share on other sites
JohnnyThrash

The "Set" version isn't documented, so you have to make the assumption that Microsoft didn't intend it to be called and as such, may be changed at any time.

Thanks JRowe, but Richard Robertson has exactly my thoughts. This isn't very well documented, I'm a bit lost. I had begun to attempt it but there were too many unknown variables.

Share this post


Link to post
Share on other sites
JRowe

This is the function I found

DwmpSetColorization(ByVal ColorizationColor As UInt32, ByVal ColorizationOpaqueBlend As Boolean, ByVal Opacity As UInt32)

Something like this should work.

$hDll = DllOpen("dwmapi.dll") ; wherever / whatever the right dll is I don't know. You'll have to find it and set it.
$iColorNumber = 123456 ; I have no clue how the color number is formatted as an integer
$bColorizationOpaqueBlend = 1; 1 on, 0 off?
$iOpacity = 128 ;Probably between 1 and 255
DllCall($hDll, "none", "DwmpSetColorization", "int", $iColorNumber, "int", $bColorizationOpaqueBlend, "int", $iOpacity)

And like RichardRobertson said, it's not a documented function, so may disappear at any time. The parameters for GetColorization should give you a handle on how to correctly set the parameters for this function. And if it doesn't work, then it's probably already disappeared, and this really isn't the function you're looking for. Also, change none to "none:cdecl" if it requires that, I'm not sure.

Good luck.

Edited by JRowe

Share this post


Link to post
Share on other sites
JRowe

I'm not seeing the function in the dll, in c:/Windows/System32 .

http://msdn.microsoft.com/en-us/library/aa969527%28VS.85%29.aspx

Obviously it's possible, using the aero settings I can change the color in realtime. A quick hack would be to invisibly open the personalization manager and manipulating the controls.

Share this post


Link to post
Share on other sites
ProgAndy

pinvoke states the function DwmpSetColorization is at EntryPoint #104. So try to use this instead of the name:

DLLCall("dwmapi.dll", 'int', 104, "int", $iColorNumber, "int", $bColorizationOpaqueBlend, "int", $iOpacity)
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
JRowe

That seems to work. I'm not going to play with it much, but this seems to function.

$hDll = DllOpen("c:/Windows/System32/dwmapi.dll")
$iColorNumber = 10 ; I have no clue how the color number is formatted
$bColorizationOpaqueBlend = 0; 1 on, 0 off? Mr. Miyagi wax time - 0101.
$iOpacity = 0 ;Probably between 1 and 255
DllCall($hDll, "none", 104, "int", $iColorNumber, "int", $bColorizationOpaqueBlend, "int", $iOpacity)
ConsoleWrite("Error:" & @error & @CRLF)

Share this post


Link to post
Share on other sites
Richard Robertson

The color number is 0xAARRGGBB format and the opacity parameter is a 0 or 1 for opaque or not.

I assume this based on the documentation for http://msdn.microsoft.com/en-us/library/aa969513%28VS.85%29.aspx

Edited by Richard Robertson

Share this post


Link to post
Share on other sites
JohnnyThrash

That seems to work. I'm not going to play with it much, but this seems to function.

$hDll = DllOpen("c:/Windows/System32/dwmapi.dll")
$iColorNumber = 10 ; I have no clue how the color number is formatted
$bColorizationOpaqueBlend = 0; 1 on, 0 off? Mr. Miyagi wax time - 0101.
$iOpacity = 0 ;Probably between 1 and 255
DllCall($hDll, "none", 104, "int", $iColorNumber, "int", $bColorizationOpaqueBlend, "int", $iOpacity)
ConsoleWrite("Error:" & @error & @CRLF)

This is great, works like magic. The best part about this find is that I could not find any good information out there on google, but you nailed it man.

The Code Below works great for changing the color to black

$hDll = DllOpen(@WindowsDir&"/System32/dwmapi.dll")
$iColorNumber = 3640655872 ; I retrieved this number from the registry. Makes the color black.
$bColorizationOpaqueBlend = 0; Glass or Solid.
$iOpacity = 50 ;No Idea?
DllCall($hDll, "none", 104, "int", $iColorNumber, "int", $bColorizationOpaqueBlend, "int", $iOpacity)

NOTE: I also tried this with other colors such as red, still works great.

ALSO: Can anybody confirm this works in Windows 7?

Edited by JohnnyThrash

Share this post


Link to post
Share on other sites
Tvern

Doesn't seem to. I guess the function has a different entrypoint.

Share this post


Link to post
Share on other sites
JRowe
Richard Robertson

That number for black that you used equals 0xD9000000 in hex. This means it's actually a semitransparent black.

Share this post


Link to post
Share on other sites
JohnnyThrash

Doesn't work in Win7, which is what I got. Glad it worked for you, though. :mellow:

That's a damned shame. Not much use it won't work on the latest operating system.

By the way, Richard, What then is the hex code for a solid black? And how can I convert that number into a regular decimal?

Share this post


Link to post
Share on other sites
ProgAndy

I found a DLLCall for Win7 http://social.msdn.microsoft.com/Forums/de-DE/windows7de/thread/ad570e44-a221-484d-836e-6e3c146080c0 (description only german)

Edit: Found an english source: http://stackoverflow.com/questions/1487919/how-does-windows-change-aero-glass-color

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
Richard Robertson

You can use the hex directly. It's a little easier to read when it comes to colors.

0xFF000000 = solid black, because the alpha byte is set to 0xFF (255).

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.