phew Posted August 27, 2007 Share Posted August 27, 2007 hi, i've found http://www.autoitscript.com/forum/index.php?showtopic=5798which says:RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $sFile) DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $sFile, "int", 0)would change the wallpaper, but when i execute my script_ChangeWallpaper() Func _ChangeWallpaper() RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', "C:\Dokumente und Einstellungen\phew\Desktop\hello.jpg") DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", "C:\Dokumente und Einstellungen\phew\Desktop\hello.jpg", "int", 0) EndFuncthe desktop background just becomes light-blue but the new wallpaper is not set. (on rightmouse (desktop) -> properties the wallpaper is previewed but finally its not changed on the desktop!)someone can help? Link to comment Share on other sites More sharing options...
SandelPerieanu Posted August 27, 2007 Share Posted August 27, 2007 hi, i've found http://www.autoitscript.com/forum/index.php?showtopic=5798 which says: RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $sFile) DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $sFile, "int", 0) would change the wallpaper, but when i execute my script _ChangeWallpaper() Func _ChangeWallpaper() RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', "C:\Dokumente und Einstellungen\phew\Desktop\hello.jpg") DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", "C:\Dokumente und Einstellungen\phew\Desktop\hello.jpg", "int", 0) EndFunc the desktop background just becomes light-blue but the new wallpaper is not set. (on rightmouse (desktop) -> properties the wallpaper is previewed but finally its not changed on the desktop!) someone can help? only *.bmp files Link to comment Share on other sites More sharing options...
phew Posted August 27, 2007 Author Share Posted August 27, 2007 thank you very much :] my bad, didn't read the other topic carefully but is there any possibility to use .JPG files, too? Link to comment Share on other sites More sharing options...
SandelPerieanu Posted August 27, 2007 Share Posted August 27, 2007 thank you very much :]my bad, didn't read the other topic carefullybut is there any possibility to use .JPG files, too?try this with auto3lib.exe Link to comment Share on other sites More sharing options...
phew Posted August 27, 2007 Author Share Posted August 27, 2007 okay i'll do, thank you Link to comment Share on other sites More sharing options...
SandelPerieanu Posted August 27, 2007 Share Posted August 27, 2007 okay i'll do, thank you use this #Include <A3LGDIPlus.au3> Opt("MustDeclareVars", 1) Global $sImage, $hImage, $sCLSID $sImage = @ScriptDir & '\Image.jpg' _GDIP_StartUp() $hImage = _GDIP_ImageLoadFromFile($sImage) $sCLSID = _GDIP_EncodersGetCLSID("BMP") _GDIP_ImageSaveToFileEx($hImage, @ScriptDir & '\Image.bmp', $sCLSID)) _GDIP_ShutDown() to convert *.jpg into *.bmp Link to comment Share on other sites More sharing options...
Achilles Posted August 27, 2007 Share Posted August 27, 2007 All together it looks like this: Func _ChangeDesktopBackground($sFile, $iPosition = 3) Local $sCLSID, $tBuffer, $hImage, $sTemp ; Convert image to BMP image _GDIP_Startup() $hImage = _GDIP_Image($sFile) $sCLSID = _GDIP_EncodersGetCLSID('BMP') $sTemp = _Str_ChangeFileExt($sFile, '.bmp') _GDIP_ImageSaveToFile($hImage, $sTemp) _GDIP_ImageDispose($hImage) _GDIP_Shutdown() ; Set wallpaper position Switch $iPosition Case 1; Tiled RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '1') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0') Case 2; Centered RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0') Case 3; Stretched RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0') RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2') EndSwitch ; Set wallpaper $tBuffer = DllStructCreate("char Text[" & StringLen($sTemp) + 1 & "]") DllStructSetData($tBuffer, "Text", $sTemp) _API_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Der_Andi Posted December 1, 2007 Share Posted December 1, 2007 Does Windows XP also convert pictures in bitmap-format when i change my wallpaper? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now