如何获得选择壁纸的名字 [英] How to get the name of the select wallpaper

查看:95
本文介绍了如何获得选择壁纸的名字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能在Windows当前桌面墙纸的名称,使用C#?

How can I get the name of the current desktop wallpaper in Windows, using C#?

推荐答案

根据@ tanascius的回答,我想出了这个代码

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

这篇关于如何获得选择壁纸的名字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆