Jump to content



Photo

Change XP desktop color


  • Please log in to reply
6 replies to this topic

#1 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 11 May 2011 - 11:52 AM

I have a need to change my XP desktop color via code. Should be dead simple, but I've spent several hours trying to solve this. I'd be happy if someone called me a worthless n00b and pointed out the obvious to me. :unsure:

I've tried code I dug up in the forum:
$COLOR_DESKTOP = 1 $COLOR = 0xFFFFFF $DLL_Call = DLLCall("user32.dll","int","SetSysColors","int",1,"int_ptr",$COLOR_DESKTOP,"int_ptr",$color)

but nothing happens.

I've tried this:
RegWrite("HKEY_CURRENT_USER\Control Panel\Colors", "Background", "REG_SZ", "102 154 202") RunWait("rundll32 user32.dll,UpdatePerUserSystemParameters")

... and nothing.

Changing the registry key
HKEY_CURRENT_USER --> Control Panel --> Colors --> Background
works on reboot, but I need to have it immediate.

I've looked at the help, including _WinAPI_SetBkColor in the help, but the code left me glassy-eyed, and doesn't appear to be what I want.

While I'm able to change the wallpaper immediately, I don't want that. I simply want to change the background color, and leave any wallpaper intact.

I munged together code to open Display Properties and make the necessary changes, but that's ugly, and I hope won't be necessary.

Hope someone can help me!





#2 guinness

guinness

    guinness

  • MVPs
  • 10,347 posts

Posted 11 May 2011 - 11:56 AM

Just a thought it might require a Restart of Explorer.exe?!

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#3 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 11 May 2011 - 01:10 PM

Just a thought it might require a Restart of Explorer.exe?!


The line

RunWait("rundll32 user32.dll,UpdatePerUserSystemParameters")

is supposed to refresh the entire desktop. Doesn't seem to work.

Tried manually killing explorer.exe and restarting. Didn't make a difference. :unsure:
Thanks anyway.

#4 JFX

JFX

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 11 May 2011 - 01:58 PM

Something like this?

#Include <WinAPI.au3> _WinAPI_SetSysColors(1, 0xca9a66)


#5 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 11 May 2011 - 05:43 PM

Something like this?

#Include <WinAPI.au3> _WinAPI_SetSysColors(1, 0xca9a66)

You sir, are a saint! :unsure:

Thank you. I don't know why I had such a hard time with it.

#6 guinness

guinness

    guinness

  • MVPs
  • 10,347 posts

Posted 11 May 2011 - 06:44 PM

I still see I have a lot of the Help File to read :unsure:

#include <WinAPI.au3> #include <WindowsConstants.au3> ConsoleWrite(_GetBackgroundColor() & @CRLF) ConsoleWrite(_SetBackgroundColor(0xFFFFFF) & @CRLF) Func _GetBackgroundColor()     Return _WinAPI_GetSysColor($COLOR_BACKGROUND) EndFunc   ;==>_GetBackgroundColor Func _SetBackgroundColor($bColor)     Return _WinAPI_SetSysColors($COLOR_BACKGROUND, $bColor) EndFunc   ;==>_SetBackgroundColor

Edited by guinness, 19 November 2011 - 10:38 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#7 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 13 May 2011 - 11:23 AM

I still see I have a lot of the Help File to read :unsure:

#include <WinAPI.au3> #include <WindowsConstants.au3> ConsoleWrite(_GetBackgroundColor() & @CRLF) ConsoleWrite(_SetBackgroundColor(0xFFFFFF) & @CRLF) Func _GetBackgroundColor()     Return _WinAPI_GetSysColor($COLOR_BACKGROUND) EndFunc   ;==>_GetBackgroundColor Func _SetBackgroundColor($bColor)     Local $iError = 0     _WinAPI_SetSysColors($COLOR_BACKGROUND, $bColor)     If @error Then         $iError = 1     EndIf     Return SetError($iError, 0, $bColor) EndFunc   ;==>_SetBackgroundColor

Thank you for posting this.
The built-in help for AutoIt is second to none, but there are some examples that I wrestle with. This helps.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users