Setting the desktop wallpaper

BlitzMax Forums/BlitzMax Beginners Area/Setting the desktop wallpaper

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

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.

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

groovy thanks, I'll test this soon...

Well. It works with 1.20

Barney

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?

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)


well i guess - obviously really - thanks.

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.