Sign in to follow this  
Followers 0
flyingboz

Change Desktop WallPaper

7 posts in this topic

Func _ChangeDestopWallpaper($bmp, $style = 0)
;===============================================================================
;
; Function Name:    _ChangeDesktopWallPaper
; Description:     Update WallPaper Settings
;Usage:           _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1)
; Parameter(s):  $bmp - Full Path to BitMap File (*.bmp)
;                             [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched
; Requirement(s):   None.
; Return Value(s):  On Success - Returns 0
;                  On Failure -   -1  
; Author(s):        FlyingBoz
;Thanks:        Larry - DllCall Example - Tested and Working under XPHome and W2K Pro
;                    Excalibur - Reawakening my interest in Getting This done.
;
;===============================================================================
      
   If Not FileExists($bmp) Then Return -1
  ;The $SPI*  values could be defined elsewhere via #include - if you conflict,
  ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
   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", $bmp, _
         "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
   Return 0
EndFunc  ;==>_ChangeDestopWallpaper


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

i have also done this a long time ago.

http://www.autoitscript.com/forum/index.ph...topic=13426&hl=

and so did ezzetabi

http://www.autoitscript.com/forum/index.php?showtopic=5769

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@Wouter

No offense, but your example doesn't support styles

Ezz's example doesn't support optional style, and did not work in my w2k environment.

@ALL

If anyone tries this on a different OS and gets unexpected results, please let me know.

Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What exactly is the $style = 0 parameter that is being passed into _ChangeDestopWallpaper function?

Edited by parkerbl

Share this post


Link to post
Share on other sites

; [$style]- 0 = Centered, 1 = Tiled, 2 = Stretched

The style = 0 in the code basically means that if no style is called, it'll default to 0.

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hey man!

It's know this a long time ago.

try this and stop!

*.jpg and *.bmp :lmao:

Edited by psandu.ro

Share this post


Link to post
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
Sign in to follow this  
Followers 0