I wrote an app that changes the Windows wallpaper by registry, but I need to notify Explorer.exe so I can see the new background. I tried using SendMessageTimeoutW
:
SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
0, 0, SMTO_ABORTIFHUNG, 5000, NULL);
However, it did not work. Any function I can use?
Don't modify the windows registry directly for this kind of settings; the correct way to modify the wallpaper is to call the
SystemParametersInfo
API, passingSPI_SETDESKWALLPAPER
, passing the path to the wallpaper inpvParam
andSPIF_UPDATEINIFILE | SPIF_SENDCHANGE
infWinIni
(which makes the modification permanent).