请教小弟我怎么知道电脑当前使用的桌面背景图片的名称
请问我如何知道电脑当前使用的桌面背景图片的名称?
请问我如何知道电脑当前使用的桌面背景图片的名称?我想知道如何用程序知道当前桌面的背景图片是什么,存放在哪里?最重要的是使用了哪张图片?麻烦各位了,谢谢!
------解决方案--------------------
最好提供源代码全一点的。我也想看一看。
------解决方案--------------------
调用API,分析explorer进程
------解决方案--------------------
如果我没有猜错的话,可以试下读取注册表信息看看。。
------解决方案--------------------
正在观望中……
------解决方案--------------------
------解决方案--------------------
HKEY_CURRENT_USER\control panel\desktop中的ConvertedWallpaper
不知道是不是这个地址。。。
------解决方案--------------------
7楼正确。
另外可能通过API来获得,SystemParametersInfo参数SPI_GETDESKWALLPAPER
------解决方案--------------------
Api SystemParametersInfo
参考:
http://www.accdb.net/article.asp?id=911
------解决方案--------------------
请问我如何知道电脑当前使用的桌面背景图片的名称?我想知道如何用程序知道当前桌面的背景图片是什么,存放在哪里?最重要的是使用了哪张图片?麻烦各位了,谢谢!
------解决方案--------------------
最好提供源代码全一点的。我也想看一看。
------解决方案--------------------
调用API,分析explorer进程
------解决方案--------------------
如果我没有猜错的话,可以试下读取注册表信息看看。。
------解决方案--------------------
正在观望中……
------解决方案--------------------
------解决方案--------------------
HKEY_CURRENT_USER\control panel\desktop中的ConvertedWallpaper
不知道是不是这个地址。。。
------解决方案--------------------
7楼正确。
另外可能通过API来获得,SystemParametersInfo参数SPI_GETDESKWALLPAPER
------解决方案--------------------
Api SystemParametersInfo
参考:
http://www.accdb.net/article.asp?id=911
------解决方案--------------------
- C# code
using System; using Microsoft.Win32; namespace WallPaper { class Program { static void Main(string[] args) { RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme"); if (rk == null) { Console.WriteLine("不存在!"); return; } Console.WriteLine("Wallpaper:" + rk.GetValue("Wallpaper")); Console.WriteLine("按Enter退出!"); Console.ReadLine(); } } }
------解决方案--------------------
对。注册表里应该可以查到。
------解决方案--------------------
1.引入com定义
enum WPSTYLE
{
CENTER = 0,
TILE = 1,
STRETCH = 2,
MAX = 3
}
struct WALLPAPEROPT
{
public int dwSize;
public WPSTYLE dwStyle;
}
struct COMPONENTSOPT
{
public int dwSize;
[MarshalAs(UnmanagedType.Bool)] public bool fEnableComponents;
[MarshalAs(UnmanagedType.Bool)] public bool fActiveDesktop;
}
struct COMPPOS
{
public const int COMPONENT_TOP = 0x3FFFFFFF;
public const int COMPONENT_DEFAULT_LEFT = 0xFFFF;
public const int COMPONENT_DEFAULT_TOP = 0xFFFF;
public int dwSize;
public int iLeft;
public int iTop;
public int dwWidth;
public int dwHeight;
public int izIndex;
[MarshalAs(UnmanagedType.Bool)] public bool fCanResize;
[MarshalAs(UnmanagedType.Bool)] public bool fCanResizeX;
[MarshalAs(UnmanagedType.Bool)] public bool fCanResizeY;
public int iPreferredLeftPercent;
public int iPreferredTopPercent;
}
[Flags]
enum ITEMSTATE
{
NORMAL = 0x00000001,
FULLSCREEN = 00000002,
SPLIT = 0x00000004,
VALIDSIZESTATEBITS = NORMAL | SPLIT | FULLSCREEN,
VALIDSTATEBITS = NORMAL | SPLIT | FULLSCREEN |
unchecked((int)0x80000000) | 0x40000000
}
struct COMPSTATEINFO
{
public int dwSize;
public int iLeft;
public int iTop;
public int dwWidth;