【问题标题】:changing wallpaper c++ ive tried multiple ways更改墙纸 c++ 我尝试了多种方法
【发布时间】:2021-05-01 21:41:04
【问题描述】:
string s = "C:\\ok.bmp";
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (void*)s.c_str(), SPIF_SENDCHANGE);

这不起作用 ^^ 并且 ok.bmp 在文件夹中!

【问题讨论】:

    标签: c++


    【解决方案1】:

    现在大多数构建都是 Unicode,所以尝试使用 Unicode 字符串:

    wstring ws = L"C:\\ok.bmp";
    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ws.data(), SPIF_SENDCHANGE);
    

    (通过使用std::wstring::data(),您不需要演员表)。

    【讨论】:

      猜你喜欢
      • 2018-05-09
      • 2020-09-22
      • 1970-01-01
      • 2013-07-23
      • 1970-01-01
      • 2012-01-14
      • 1970-01-01
      • 1970-01-01
      • 2014-11-09
      相关资源
      最近更新 更多