Jump to content

Recommended Posts

Posted (edited)

Func _ChangeWallpaper($sFile,$iType)
  ; Changes the wallpaper to $sFilename using $iType as:
  ; 1 Tiled
  ; 2 Centered
  ; 3 Stretched
  ; any other value (usually 0) unchanged
  ;
  ; Returns
  ; 0 if everything is allright.
  ; -1 if $sFile does not exist. @error is set to 1
  ; -2 if £sFile is not a .bmp file. @error is set to 2
   
   If Not FileExists($sFile) Then
      SetError(1)
      Return -1
   EndIf
   If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then
      SetError(2)
      Return -2
   EndIf
   
   Select
   Case $iType = 1
      RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1')
      RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
   Case $iType = 2
      RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
      RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0')
   Case $iType = 3
      RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0')
      RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2')
   Case Else
    ;
   EndSelect
   
   RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
   DllCall("user32","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)
   
   Return 0
EndFunc

:)

Edited by ezzetabi
Posted (edited)

Yes. non .bmp can be set only via Active desktop and it can't be done via this dllcall.

Maybe I'll try to implement (again via dllcall) an autoconversion to .bmp later.

So it woud become avaiable also .jpg, .jpeg and non animated .gif

Edit: sorry, I can't find any info about mwgfx.dll for converting. So only .bmp :) .

Edited by ezzetabi
Posted

DllCall("user32","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0)

isn't that supposed to be a varible? or something infront of it. if i copy it just as is on windows 2000 it just errors out? :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...