How to determine when wallpapers have changed (Windows XP or higher)?

I figured out how to change the desktop wallpaper (there are dozens of examples on the Internet.)

One thing that still eludes me: how can I tell when the wallpaper has changed? (Say through the control panel display or another program that changes it.)

+4
source share
2 answers

Add a message handler for WM_SETTINGCHANGE, SystemEvents.UserPreferenceChanged in .NET. Check if the wallpaper remains both.

+7
source

Here is an example in C # for extracting wallpapers. All you need to add is additional code to store the latest wallpapers and check to see if it is different.

RegistryKey wallpaper = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop",false); string wallpapername = wallpaper.GetValue("wallpaper").ToString(); wallpaper.Close(); 

If you are writing something in non.net, you can use the Win32 API function RegNotifyChangeKeyValue to check if this value has changed:

 HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper 
+4
source

All Articles