forked from github_mirror/framelesshelper
Utils: Win32: Fix API usage
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
95d72997ed
commit
97d9009500
|
@ -563,10 +563,10 @@ QImage Utilities::getDesktopWallpaperImage(const int screen)
|
|||
qWarning() << "Failed to initialize COM.";
|
||||
}
|
||||
qDebug() << "Shell API failed. Using SystemParametersInfoW instead.";
|
||||
LPWSTR wallpaperPath = nullptr;
|
||||
const auto wallpaperPath = new WCHAR[MAX_PATH];
|
||||
if (SystemParametersInfoW(SPI_GETDESKWALLPAPER, MAX_PATH, wallpaperPath, 0) != FALSE) {
|
||||
const QString _path = QString::fromWCharArray(wallpaperPath);
|
||||
CoTaskMemFree(wallpaperPath);
|
||||
delete [] wallpaperPath;
|
||||
return QImage(_path);
|
||||
}
|
||||
qWarning() << "SystemParametersInfoW failed. Reading from the registry instead.";
|
||||
|
|
Loading…
Reference in New Issue