Advertisement
rahulkchou

Change desktop background C#

Jul 4th, 2020
1,647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  2. private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32 uiParam, String pvParam, UInt32 fWinIni);
  3. private static UInt32 SPI_SETDESKWALLPAPER = 20;
  4. private static UInt32 SPIF_UPDATEINIFILE = 0x1;
  5.  
  6. static void Main(string[] args){
  7.     string imageFileName = "C:\\file.jpg";
  8.     SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imageFileName, SPIF_UPDATEINIFILE);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement