How to discover which image file is the current desktop background on Windows?

可紊 提交于 2019-12-07 21:07:56

问题


It is possible to discover it programatically? It will use the Windows Registry? I'll need to take a screenshot of it and compare with the files on disk? Is it possible to discover even in the desktop slideshow mode?


回答1:


try this

using Microsoft.Win32;

private string GetCurrentWallpaper()

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

Bye.




回答2:


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



回答3:


The registry key is HKCU\Control Panel\Desktop\Wallpaper




回答4:


You need to use SystemParametersInfo() there is a tutorial on Geekpedia with more information on how to accomplish this with the different Windows OS's and systems.



来源:https://stackoverflow.com/questions/1490202/how-to-discover-which-image-file-is-the-current-desktop-background-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!