title: change desktop wallpaper c#
body: <p>I want to create a program that saves a bmp image file on the driver and sets the image as wallpaper. The code i managed to write saves the image in the correct place but the image doesn't appear as the wallpaper. Please help...</p>
  
  <pre><code>class Program
  {
      [DllImport("user32.dll", CharSet = CharSet.Auto)]
      private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32
      uiParam,String pvParam, UInt32 fWinIni);
      private static UInt32 SPI_SETDESKWALLPAPER = 20;
      private static UInt32 SPIF_UPDATEINIFILE = 0x1;
      private String imageFileName = "D:\\wall.bmp";
  
  
      static void Main(string[] args)
      {
          Bitmap bmp = new Bitmap(Properties.Resources.wall);
          bmp.Save("D:\\wall.bmp");
          SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "D:\\wall.bmp", SPIF_UPDATEINIFILE);
      }
  
  
  
  
  
  }
  </code></pre>