Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where's the wallpaper registry key in Windows 8?

Tags:

c#

.net

I'm working on a tool that needs to get the current user's wallpaper path.

On Windows 7, I can get that by reading

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\WallpaperSource.

On my Windows 8 installation, that key always has the value

C:\Users\Peter\AppData\Roaming\Microsoft\Windows Photo Viewer\Windows Photo Viewer Wallpaper.jpg

which is not even the wallpaper that's currently set.

Is there any other key I can rely on?

like image 523
Peter W. Avatar asked Jul 01 '12 00:07

Peter W.


1 Answers

You are FAR better off calling SystemParametersInfo with the SPI_SETDESKWALLPAPER option to set the desktop wallpaper. As far as I can tell, registry key you're using is undocumented and thus can change at any time without warning.

See this stack overflow question for an example of how to call the SystemParametersInfo with SPI_SETDESKWALLPAPER.

like image 186
ReinstateMonica Larry Osterman Avatar answered Oct 20 '22 21:10

ReinstateMonica Larry Osterman