ezzetabi Posted October 30, 2004 Share Posted October 30, 2004 (edited) expandcollapse popupFunc _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 October 30, 2004 by ezzetabi jvds 1 Link to comment Share on other sites More sharing options...
SlimShady Posted October 30, 2004 Share Posted October 30, 2004 That's nice. I'll test it later. A question: Does it have to be a bmp file? Link to comment Share on other sites More sharing options...
ezzetabi Posted October 30, 2004 Author Share Posted October 30, 2004 (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 October 30, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted October 30, 2004 Share Posted October 30, 2004 I run it, but nothings happend? Link to comment Share on other sites More sharing options...
ezzetabi Posted October 30, 2004 Author Share Posted October 30, 2004 mmm.. I can't say. I disabled Active desktop completly. Link to comment Share on other sites More sharing options...
Somerset Posted October 31, 2004 Share Posted October 31, 2004 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? Link to comment Share on other sites More sharing options...
ezzetabi Posted November 1, 2004 Author Share Posted November 1, 2004 $sFile is a variable. 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