Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 25, 2022 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/17ea0c3b68abc9e69f791797e40341b4 to your computer and use it in GitHub Desktop.
Save parzibyte/17ea0c3b68abc9e69f791797e40341b4 to your computer and use it in GitHub Desktop.
[DllImport("user32.dll")]
public static extern Int32 SystemParametersInfo(
UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);
public static readonly UInt32 SPI_SETDESKWALLPAPER = 0x14;
public static readonly UInt32 SPIF_UPDATEINIFILE = 0x01;
public static readonly UInt32 SPIF_SENDWININICHANGE = 0x02;
public static void SetWallpaper(String path)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path,
SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment