Jump to content

Dynamically Changing Vista's Glass Color?


Recommended Posts

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

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...