ludocus Posted March 28, 2008 Share Posted March 28, 2008 (edited) here\'s the function:I saved it in my include list as desktop.au3expandcollapse popup#Include <GDIPlus.au3> ;=============================================================================== ; ; Description: Sets the desktop wallpaper picture ; Syntax: _setwallpaper($pic, $style = 0, $warn = 1) ; Parameter(s): $pic - Path and filename of the picture to set ( JPG or BITMAP ) ; $style - 0 = centered 1 = Tiled 2 = Stretched ( set to 0 ) ; $warn - 0 = false 1 = true ( set to 1 ) ; Requirement(s): none ; Return Value(s): On Success - Returns 0 ; On Failure - Returns -1 ; Author(s): ludocus ; Note(s): $warn may be anoying,.. Build in picture converter to bmp ; ;=============================================================================== Func _setwallpaper($pic, $style = 0, $warn = 1) if $warn = 1 then $m1 = @DesktopHeight/2 $m2 = @DeskTopWidth/2 ToolTip (\"Setting new walpaper\", $m2, $m1, \"Please wait..\", 1 ) EndIf If Not FileExists($pic) Then Return -1 $s = StringSplit ( $pic, \'.\', 1 ) if $s[2] = \'bmp\' Then ;If Not $s[2] = \'bmp\' then.... didn\'t seem to be working, so that\'s why I did this.. $bmp = \'true\' Else $bmp = \'false\' EndIf If $bmp = \'false\' then $text = StringReplace($pic, \".jpg\", \".bmp\") _GDIPlus_Startup () $hImage = _GDIPlus_ImageLoadFromFile($pic) $sCLSID = _GDIPlus_EncodersGetCLSID (\"BMP\") _GDIPlus_ImageSaveToFileEx($hImage, $text, $sCLSID) _GDIPlus_ShutDown() $pic = $text EndIf Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP= \"HKEY_CURRENT_USER\\Control Panel\\Desktop\" if $style = 1 then RegWrite($REG_DESKTOP, \"TileWallPaper\", \"REG_SZ\", 1) RegWrite($REG_DESKTOP, \"WallpaperStyle\", \"REG_SZ\", 0) Else RegWrite($REG_DESKTOP, \"TileWallPaper\", \"REG_SZ\", 0) RegWrite($REG_DESKTOP, \"WallpaperStyle\", \"REG_SZ\", $style) EndIf DllCall(\"user32.dll\", \"int\", \"SystemParametersInfo\", _ \"int\", $SPI_SETDESKWALLPAPER, _ \"int\", 0, _ \"str\", $pic, _ \"int\", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 if $warn = 1 then sleep ( 2000 ) EndIf EndFunc ;==>_setwallpaperHave Fun!Created by: flyingbozedited by: ludocus Edited March 30, 2008 by ludocus Link to comment Share on other sites More sharing options...
Kip Posted March 29, 2008 Share Posted March 29, 2008 (edited) I bet you didnt write that by yourself.Edit: yup, http://www.autoitscript.com/forum/index.php?showtopic=16628 made it. You just added 5 lines, and you claim you created the whole script. Edited March 30, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ludocus Posted March 30, 2008 Author Share Posted March 30, 2008 (edited) I bet you didnt wrote that by yourself.in english you would say: I bet you didn't write that by yourself. Edited March 30, 2008 by ludocus Link to comment Share on other sites More sharing options...
Kip Posted March 30, 2008 Share Posted March 30, 2008 yeah, but thats not my point MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. 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