How to change desktop background using VC++

前端 未结 2 1748
南笙
南笙 2021-01-16 07:11

I am currently trying to change my desktop background using SystemParametersInfo() vs doesnt give me any errors when I type my stuff in but when I run the program I get this

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-16 07:34

    You need to add L to the file path. L"C:/Windows/Downloaded Program Files/Flowers.jpg" .

    #include "stdafx.h"
    #include 
    
    int main() {
    
        int return_value = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, L"d:/flower1.jpg", SPIF_UPDATEINIFILE);
    
        return 0;
    }
    

提交回复
热议问题