How to get the name of your favorite wallpaper

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

+4
source share
2 answers

Based on @tanascius 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(); 
+2
source

Something like this ?

 var wpReg = Registry.CurrentUser.OpenSubKey( "Control Panel\\Desktop", false ); var wallpaperPath = wpReg.GetValue( "WallPaper" ).ToString(); wpReg.Close(); 

From the path you can extract the file name ...

+5
source

Source: https://habr.com/ru/post/1308477/


All Articles