#include <iostream>
#include <windows.h>
using namespace std;
int main(){
LPWSTR test = L"C:/aizen.png";
int result = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, test, SPIF_UPDATEINIFILE);
if(result)
cout << "Wallpaper set!";
else
cout << "NOOOOO!" << result;
cin >> result;
return 0;
}
非常簡單的代碼,但結果返回0.我做錯了什麼?SystemParametersInfo返回0
您可以嘗試'GetLastError()'以查明有什麼問題 –
[The docs](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v = vs.85) .aspx)say「** Note **當使用SPI_SETDESKWALLPAPER標誌時,SystemParametersInfo總是返回TRUE。 –
@Carl文檔講述了一個偉大的大謊! –