Desktop background

BlitzMax Forums/BlitzMax Programming/Desktop background

The pvParam can, depending on the value of uiAction, point to a number of different variable types and can be used for both input and output.

Plash's version is ever so slighlty incorrect in that the returned string can be any length up to MAX_PATH, which on my system is set to 260 characters for instance. This is generally not gonna be a problem, but no point in setting yourself up for potential problems in the future.

I use something like this...
Strict

?Win32
	Const SPI_GETDESKWALLPAPER = $73

	Extern "win32"	
		Function SystemParametersInfo(uiAction, uiParam, pvParam:Byte Ptr, fWinIni) = "SystemParametersInfoA@16"	
	End Extern
?

Print GetWallPaperPath()

End


Function GetWallPaperPath$()
?Win32
	Local buff@[MAX_PATH]
	
	SystemParametersInfo(SPI_GETDESKWALLPAPER, buff@.length, buff@, Null)
	
	Return String.FromCString(buff@)
?
End Function