I\'ve been trying to write an application, using Qt and mingw32, to download images and set them as the background Wallpaper. I have read several articles online about how to do
It could be that SystemParametersInfo
is expecting an LPWSTR
(a pointer to wchar_t
).
Try this:
LPWSTR test = L"C:\\Documents and Settings\\Owner\\My Documents\\Wallpapers\\wallpaper.png";
result = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, test, SPIF_UPDATEINIFILE);
If this works (try it with a few different files just to make sure), you'll need to convert your char *
to a LPWSTR
. I'm not sure if Qt offers these services, but one function that may help is MultiByteToWideChar.