日期:2014-05-18 浏览次数:21211 次
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;