Hello,
I've now tried three methods to get the wallpaper on my desktop to change:-
Code:
(Method 1)
DWORD dwRet;
dwRet = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\Image1.bmp", SPIF_SENDCHANGE); //returns 0 (GetLastError returns 0?!?)
(Method 2)
HKEY hKey;
RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_SET_VALUE, &hKey);
RegSetValueEx(hKey, "Wallpaper", 0, REG_SZ, "C:\\Image1.bmp", 14);
RegCloseKey(hKey);
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Wallpaper", SMTO_NORMAL, 5, NULL);
(Method 3)
WriteProfileString("Desktop", "Wallpaper", "C:\\Image1.bmp");
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Wallpaper", SMTO_NORMAL, 5, NULL);
With the first method, nothing happens at all. With the second method, the entry in Display Properties changes, but the desktop doesn't change. With the third method, the entry in WIN.INI changes, but the desktop doesn't change. Everyone seems to be able to use the first method just fine, but for some reason I can't get any of these methods to work properly!