Jump to content

Changing Windows Color Scheme


Recommended Posts

Greetings,

This is my first post here and I would first like to say how I love this program! Next I would like to say why I am posting.

I am working on a project that automates some of our software installation tasks. The portion I am working on now needs to do the following:

1. Install a font

2. Register the font with Windows

3. install the oemlogo and ini

4. install the wallpaper

5. set screensaver to 3D Text with custom font and DisplayString

6. change Windows' Display type from XP to Windows Classic

7. change Color Scheme to "Red, White, and Blue (VGA)

8. apply color scheme changes without restarting.

I have completed tasks 1-7. I will post the code below. The problem I have is that I need Windows to apply the color scheme (similar to what the Apply/OK button in Display Properties does if you manually do it) without restarting the computer. I know that my registry settings work because if I restart the computer, the correct color scheme appears and everything else works.

I have done some research and found that you can send a message to Windows to force it to accept and display the new color scheme. It deals with one or more of these words (I have not determined how to do this yet).

SetSysColors()

WMSysColorChange()

WM_THEMECHANGED

WM_SYSCOLORCHANGE

PostMessage()

SendMessage()

HWND_BROADCAST

I am now researching the above variables/functions to determine how they are used, and if they apply. The code that exists so far is below. Note that the last line of code does not do anything noticeable in Windows, especially not change the color scheme. Any help would be appreciated. Client information changed to ******.

$key = "HKEY_CURRENT_USER\Software\Microsoft\Screensavers\Text3D"
$key2 = "HKEY_CURRENT_USER\Software\Microsoft\Screensavers\Text3D\Screen 1"
; ******* Logo setup
MsgBox(64, "******* Logo Setup", "This will install the ******* Logo onto the computer. You may need to restart the computer to see the correct font appear in the screensaver.")
; install font
FileCopy ( "\\*******\Install\LOGO's\*******\SLICE.TTF" , "C:\Windows\Fonts\SLICE.TTF" )
RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" , "SLICE (TrueType)" , "REG_SZ" , "SLICE.TTF" )
; copy files to destination
FileCopy ( "\\*******\Install\LOGO's\*******\OEMINFO.INI" , "C:\Windows\System32" )
FileCopy ( "\\*******\Install\LOGO's\*******\OEMLOGO.BMP" , "C:\Windows\System32" )
FileCopy ( "\\*******\Install\LOGO's\*******\*******.BMP" , "C:\Windows" )
; set screensaver options
RegWrite ( "HKEY_CURRENT_USER\Control Panel\Desktop" , "SCRNSAVE.EXE" , "REG_SZ" , "C:\WINDOWS\system32\sstext3d.scr" )
RegWrite($key,"AllScreensSame","REG_DWORD","0")
RegWrite($key,"SurfaceType","REG_DWORD","1")
RegWrite($key,"Specular","REG_DWORD","1")
RegWrite($key,"SurfaceColor","REG_DWORD","7829367")
RegWrite($key,"CustomTexture","REG_SZ","")
RegWrite($key,"CustomEnvironment","REG_SZ","")
RegWrite($key,"UseCustomColor","REG_DWORD","0")
RegWrite($key,"UseCustomTexture","REG_DWORD","0")
RegWrite($key,"UseCustomEnvironment","REG_DWORD","0")
RegWrite($key,"MeshQuality","REG_DWORD","500")
RegWrite($key,"Size","REG_DWORD","10")
RegWrite($key,"RotationSpeed","REG_DWORD","10")
RegWrite($key,"RotationStyle","REG_DWORD","1")
RegWrite($key,"DisplayString","REG_SZ","Predator")
RegWrite($key,"DisplayTime","REG_DWORD","0")
RegWrite($key,"FontWeight","REG_DWORD","700")
RegWrite($key,"FontHeight","REG_DWORD","4294967200")
RegWrite($key,"FontItalic","REG_DWORD","0")
RegWrite($key,"FontCharSet","REG_DWORD","16909056")
RegWrite($key,"FontPitchFamily","REG_DWORD","1627411490")
RegWrite($key,"FontFace","REG_SZ","SLICE")
RegWrite($key2,"Leave Black","REG_DWORD","0")
RegWrite($key2,"Disable Hardware","REG_DWORD","0")
RegWrite($key2,"Width","REG_DWORD","0")
RegWrite($key2,"Height","REG_DWORD","0")
RegWrite($key2,"Format","REG_DWORD","0")
; change windows appearance
RegWrite("HKEY_CURRENT_USER\Control Panel\Appearance","Current","REG_SZ","Red, White, and Blue (VGA)")
RegWrite("HKEY_CURRENT_USER\Control Panel\Appearance","NewCurrent","REG_SZ","Red, White, and Blue (VGA)")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager","WCreatedUser","REG_SZ","1")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager","ThemeActive","REG_SZ","0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Appearance\New Schemes","SelectedStyle","REG_SZ","13")
; change Color Scheme
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ActiveBorder","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ActiveTitle","REG_SZ","128 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","AppWorkSpace","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","Background","REG_SZ","0 0 66")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonAlternateFace","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonDkShadow","REG_SZ","0 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonFace","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonHilight","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonLight","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonShadow","REG_SZ","128 128 128")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","ButtonText","REG_SZ","0 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","GradientActiveTitle","REG_SZ","0 16 168")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","GradientInactiveTitle","REG_SZ","186 190 201")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","GrayText","REG_SZ","128 128 128")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","Hilight","REG_SZ","128 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","HilightText","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","HotTrackingColor","REG_SZ","128 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","InactiveBorder","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","InactiveTitle","REG_SZ","128 128 128")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","InactiveTitleText","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","InfoText","REG_SZ","0 0 128")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","InfoWindow","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","Menu","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","MenuBar","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","MenuHilight","REG_SZ","128 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","MenuText","REG_SZ","0 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","Scrollbar","REG_SZ","192 192 192")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","TitleText","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","Window","REG_SZ","255 255 255")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","WindowFrame","REG_SZ","0 0 0")
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors","WindowText","REG_SZ","0 0 0")
; set background image
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","Wallpaper","REG_SZ","C:\Windows\*******.BMP")
; notifies Windows of the system color change
DllCall("user32.dll", "int", "SendMessage", "hWnd", "HWND_BROADCAST", "int", "WM_SYSCOLORCHANGE", "int",  "0", "int", "0")
; restarts the pc
; Run ( "c:\windows\system32\shutdown.exe -r -f -t 0" )
Edited by Tripredacus
Link to comment
Share on other sites

I downloaded the Auto3Lib (don't hurt me since this isn't in that forum!) and tried to do it using those functions. Neither of the following lines I added to the bottom produce results

#include <C:\Program Files\AutoIt3\Include\A3LWinAPI.au3>

$hWnd = "HWND_BROADCAST"
$iMsg = "WM_SYSCOLORCHANGE"
$iwParam = "0"
$ilParam = "0"

_API_PostMessage($hWnd, $iMsg, $iwParam, $ilParam)
_API_SendMessage($hWnd, $iMsg, $iwParam, $ilParam)
Edited by Tripredacus
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...