Setting the desktop wallpaper

BlitzMax Forums/BlitzMax Beginners Area/Setting the desktop wallpaper

Boiled Sweets(Posted 2006) [#1]
Hi,

has anyone managed to do this?

I though I could do this...

Extern "win32"
  Function SystemParametersInfo(uiAction, uiParam, pvParam Var, fWinIni) = "SystemParametersInfoA@16"
End Extern


    	SystemParametersInfo(20, 0, file$, 1)






but it doesn't seem to work/compile


Grey Alien(Posted 2006) [#2]
I need to do this too soon. If no one solves it in the next week or so I'll have a go and let you know.


Beaker(Posted 2006) [#3]
Try this:
SuperStrict

Extern "win32"
  Function SystemParametersInfo(uiAction%, uiParam%, pvParam$z, fWinIni%) = "SystemParametersInfoA@16"
End Extern

Local file$ = "test.bmp"
SystemParametersInfo(20, 0, file, 1)

..worked in 1.16


Grey Alien(Posted 2006) [#4]
groovy thanks, I'll test this soon...


Barnabius(Posted 2006) [#5]
Well. It works with 1.20

Barney


Boiled Sweets(Posted 2006) [#6]
The trouble is I have it declared like this...

Extern "win32"
  Function SystemParametersInfo(uiAction, uiParam, pvParam Var, fWinIni) = "SystemParametersInfoA@16"
End Extern


Notice the "Var" declaration. Not too sure why its there but it seems to have to be for the function to be used to tell windows that the screen saver is running...

  SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, True, oldState, 0) ' (Win9x only)     


Any thoghts?


TomToad(Posted 2006) [#7]
how about
Extern "win32"
  Function SystemParametersInfo(uiAction, uiParam, pvParam Var, fWinIni) = "SystemParametersInfoA@16"
  Function SystemParametersInfo2(uiAction, uiParam, pvParam$z, fWinIni) = "SystemParametersInfoA@16"

End Extern

Function SetWallpaper(File:String)
	SystemParametersInfo2(20, 0, file, 1)
End Function

Local file:String = "C:\Windows\web\wallpaper\bliss.bmp"
SetWallpaper(file)



Boiled Sweets(Posted 2006) [#8]
well i guess - obviously really - thanks.


Grey Alien(Posted 2006) [#9]
Sorry to drag this up but it doesn't seem to work with .jpgs, only .bmp, any idea why?

OK just read this "Starting with Windows Vista, pvParam can specify a .jpg file."

So it'll work in vista but not in 98/XP etc.

So I need to convert the image to a bmp. Well I could do this by displaying it and doing a screengrab but does anyone have a quick bit of code to convert a jpg into a bitmap file? Thanks.