How can I get the name of the current desktop wallpaper in Windows, using C#?
Asked
Active
Viewed 1,334 times
2 Answers
5
Something like this?
var wpReg = Registry.CurrentUser.OpenSubKey( "Control Panel\\Desktop", false );
var wallpaperPath = wpReg.GetValue( "WallPaper" ).ToString();
wpReg.Close();
From the path you can extract the filename ...

tanascius
- 53,078
- 22
- 114
- 136
-
How can i do it in a mac os ?? its possible with c# our java? – Luis Apr 30 '10 at 21:32
2
Based on @tanascius's answer, I came up with this code.
Windows 7:
var wpReg = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Explorer\\Desktop\\General\\", false);
var wallpaperPath = wpReg.GetValue("WallpaperSource").ToString();
wpReg.Close();
Windows XP:
var wpReg = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", false);
var wallpaperPath = wpReg.GetValue("WallPaper").ToString();
wpReg.Close();