desktop-wallpaper

SystemParametersInfo sets wallpaper completly black (using SPI_SETDESKWALLPAPER)

狂风中的少年 提交于 2019-11-28 14:29:27
I try to change my desktop wallpaper. It works just fine when I use it like this: SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\\1.jpg", SPIF_SENDCHANGE); But when I use it like this, the desktop wallpaper is set completly black: std::string s = "C:\\1.jpg"; SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &s, SPIF_SENDCHANGE); I tried to get some more info via using GetLastError() , but the return value is just 0. I also tried to use .png-files, but this doesn't change anything. Any ideas what I am doing wrong? Violet Giraffe Try this: SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (void*)s.c