static void setDesktop() { try { if (imagePath.Length == 0) { Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Stream s = myAssembly.GetManifestResourceStream("RummeryKOTH.RummeryQR.bmp"); Stream s2 = myAssembly.GetManifestResourceStream("RummeryKOTH.RummeryFS.bmp"); var path = Path.Combine(Path.GetTempPath(), "lolrum.bmp"); using (Stream file = File.Create(path)) { CopyStream(s, file); } imagePath = path; } }catch (Exception e) {} try { RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true); key.SetValue(@"WallpaperStyle", "1"); key.SetValue(@"TileWallpaper", "1"); //RegistryKey rkey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", true); using (var rkey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", true)) { rkey.SetValue("OEMBackground", 1, RegistryValueKind.DWord); } //SPI_SETDESKWALLPAPER, 0, path, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE External.SystemParametersInfo(20, 0, imagePath, 0x01 | 0x02); } catch (Exception e) { Console.WriteLine(e.Message); } }