Reputation: 11
How to change the desktop background image on Windows?
Right now, I found this solution:
SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, (PVOID*)desktop_image_file, SPIF_SENDCHANGE);
It works fine, but after a restart, the image is gone. How to save it permanently?
Upvotes: 1
Views: 248
Reputation: 595402
You need to include the SPIF_UPDATEINIFILE
flag:
SPIF_UPDATEINIFILE
Writes the new system-wide parameter setting to the user profile.
SystemParametersInfoA(..., SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
Upvotes: 2