I want to programmatically set a wallpaper. Here's the only solution I've found so far:
SystemParametersInfoW(SPI_SETDESKWALLPAPER, 1, (void*)wallpaperImageFilePath.utf16(), SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
My question is: how to tell Windows I want the wallpaper image centered (not resized)? The solution above always sets the image in stretch mode. According to MSDN, there are no flags to accompany SPI_SETDESKWALLPAPER
.
There is no API function for setting the wallpaper orientation. You have to go to the Registry directly instead, specifically the "WallpaperStyle"
and "TileWallpaper"
values of the HKEY_CURRENT_USER\Control Panel\Desktop
key. See this article for an example: