The third parameter of SystemParametersInfo is supposed to be a null terminated string containing the path to a file to set as the desktop background.
If I wanted to just set it as the null background then this works:
Code:
SystemParametersInfo
(
SPI_SETDESKWALLPAPER,
0,
"",
SPIF_SENDCHANGE
);
But when I try to set the background to a file this doesn't work. GetLastError returns ERROR_FILE_NOT_FOUND even though that's the correct path to the file.
Code:
SystemParametersInfo
(
SPI_SETDESKWALLPAPER,
0,
"H:\nn.bmp",
SPIF_SENDCHANGE
);
Even stranger when I try calling and outputting SystemParametersInfo with SPI_GETDESKWALLPAPER I get a jumbled string that looks something like 78BB5654 (so it's random looking but it's the same every time).
How can I set the desktop wallpaper? Am I formatting the path wrong?