In fact, I very quickly created a dirty little helper util in FreeBASIC. (The code is dirty as said and does no checks anywhere.)
Code: Select all
' setWallpaper.bas: sets desktop wallpaper to jpg/bmp image file passed as first argument
#Include "windows.bi"
' BOOL WINAPI SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
' https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
Dim As UINT uiAction
Dim As UINT uiParam = 0 ' 0 If not otherwise indicated by uiAction
Dim As PVOID pvParam = NULL ' NULL If not otherwise indicated by uiAction
Dim As UINT fWinIni
If (Command(1) <> "") Then ' set wall if 1st arg exists. No sanity check
uiAction = SPI_SETDESKWALLPAPER
'pvParam parameter is a pointer to a buffer containing image path as null-terminated string.
Dim As String imgPath = Command(1) ' get 1st cmd argument
Dim As ZString Ptr Img ' pointer to a null-terminated string var
Img = Allocate(Len(ImgPath)) ' set Img size to the string it will carry
*Img = ImgPath ' put imgpath at Img pointer address
pvParam = Img ' update pvParam (note: Img is already a pointer)
fWinini = SPIF_UPDATEINIFILE ' signals user profile update
/'only bmp is supported in pre-Vista
but IsWindowsVersionOrGreater() apparently unimplemented in fbc
If (IsWindowsVersionOrGreater(6, 0, 0)) Then
If (InStr(ImgPath, ".bmp") <> Len(ImgPath) - 3) Then End
EndIf '/
SystemParametersInfo(uiAction, uiParam, pvParam, fWinIni)
EndIf
Code: Select all
run """<xyscripts>\utils\setWallpaper.exe"" ""<curitem>""";