Wednesday, November 06, 2013

Changing Windows 7 aero colors on the fly

I needed to change colors of Windows 7 taskbar and window decorations from command line. Quick Googlioplaza search revealed AutoIT3 example, but it was bit lacking. See updated version below.



My use case for this was taskworker PCs. Normal colors means everything is fine but when menus turn to red PC has lost network connection. Actions are triggered by task scheduler tracking Windows eventlog.

Start by setting wanted colors via regular Windows settings and replace values below with info from HKCU\Software\Microsoft\Windows\DWM. This script can be compiled to standalone exe with Aut2Exe.
Global Const $tagCOLORIZATIONPARAMS = 'dword ColorizationColor;' & _
          'dword ColorizationAfterglow;' & _
          ' uint ColorizationColorBalance;' & _
          ' uint ColorizationAfterglowBalance;' & _
          ' uint ColorizationBlurBalance;' & _
          ' uint ColorizationGlassReflectionIntensity;' & _
          ' uint ColorizationOpaqueBlend'
          
$tCP = DllStructCreate($tagCOLORIZATIONPARAMS)
$Ret = DllCall('dwmapi.dll', 'uint', 127, 'ptr', DllStructGetPtr($tCP))

DllStructSetData($tCP, 'ColorizationAfterglow', 0x6b74b8fc)               ; Default 0x6b74b8fc
DllStructSetData($tCP, 'ColorizationAfterglowBalance', 0x2b)              ; Default 0x2b
DllStructSetData($tCP, 'ColorizationBlurBalance', 0x31)                   ; Default 0x31
DllStructSetData($tCP, 'ColorizationColor', 0x6b74b8fc)                   ; Default 0x6b74b8fc
DllStructSetData($tCP, 'ColorizationColorBalance', 0x8)                   ; Default 0x8
DllStructSetData($tCP, 'ColorizationGlassReflectionIntensity', 0x50)      ; Default 0x50
DllStructSetData($tCP, 'ColorizationOpaqueBlend', 0x0)                    ; Default 0x0

$Ret = DllCall('dwmapi.dll', 'uint', 131, 'ptr', DllStructGetPtr($tCP), 'uint', 0)

No comments:

Post a Comment

Got something to say?!