Joel Bennett on Nostr: Set the Wallpaper using SystemParametersInfo ...
Set the Wallpaper using SystemParametersInfo
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
In #PowerShell just:
Add-Type -Namespace "" -Name Desktop -MemberDefinition @"
[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint="SystemParametersInfo")]
public static extern bool SetWallpaper(int uAction = 20, int uParam = 0, string Path="Wallpaper.jpg", int fuWinIni=3);
"@
Change the image with:
[Desktop]::SetWallpaper(20,0,(Convert-Path "MyPIcture.jpg"))
Without parameters, it reverts to Wallpaper.jpg
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
In #PowerShell just:
Add-Type -Namespace "" -Name Desktop -MemberDefinition @"
[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint="SystemParametersInfo")]
public static extern bool SetWallpaper(int uAction = 20, int uParam = 0, string Path="Wallpaper.jpg", int fuWinIni=3);
"@
Change the image with:
[Desktop]::SetWallpaper(20,0,(Convert-Path "MyPIcture.jpg"))
Without parameters, it reverts to Wallpaper.jpg