开发者

How to get the name of the select wallpaper

How can I get the name of the current d开发者_Go百科esktop wallpaper in Windows, using C#?


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 ...


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜