2009-09-29 20 views

回答

1
public string GetCurrentWallpaper() 
{ 
    using(var subKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Desktop\General", false)) 
    { 
     return subKey.GetValue("WallpaperSource").ToString(); 
    } 
} 
+0

這在Windows 10上不起作用。如果圖像來自IE,並且存儲來自IE的最後一張圖像,這種方法就行得通。 – McKay 2016-07-24 01:26:47

0

該註冊表項是HKCU\Control Panel\Desktop\Wallpaper

+1

實際上,在Windows 7中,它指向一個版本的原始文件 「%USER%\應用程序數據\漫遊\微軟\的Windows \主題\ TranscodedWallpaper.jpg」 不是文件本身。我認爲在Windows 7中找到原始文件更爲困難 – 2009-09-29 02:54:59

+0

這是一個不起作用的重複答案。 – McKay 2016-07-24 01:28:16

1

試試這個

using Microsoft.Win32; 

private string GetCurrentWallpaper() 

{ 
using(RegistryKey MyWallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", false)) 
{ 
    return MyWallPaper.GetValue("WallPaper").ToString(); 
} 
} 

再見。

+0

這不適用於Windows 10。沒有這樣的密鑰 – McKay 2016-07-24 01:25:29

0

您需要使用SystemParametersInfo()有一個tutorial on Geekpedia以及有關如何使用不同的Windows操作系統和系統完成此操作的更多信息。

+0

這不是一個完整的答案,並且鏈接沒有任何內容。 – McKay 2016-07-24 01:27:58

相關問題