mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
check for Win7 before using SHCore.dll API
This commit is contained in:
parent
76e9f8896c
commit
ebe7581f62
1 changed files with 11 additions and 3 deletions
|
@ -27,7 +27,6 @@
|
||||||
#include <dxgi1_3.h>
|
#include <dxgi1_3.h>
|
||||||
#pragma comment(lib, "dxgi.lib")
|
#pragma comment(lib, "dxgi.lib")
|
||||||
#include <shellscalingapi.h>
|
#include <shellscalingapi.h>
|
||||||
#pragma comment(lib, "Shcore.lib")
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -118,10 +117,19 @@ void WINInstance::enumerateGpusAndDisplays() {
|
||||||
// Grab the dpi info for the monitor
|
// Grab the dpi info for the monitor
|
||||||
UINT dpiX{ 0 };
|
UINT dpiX{ 0 };
|
||||||
UINT dpiY{ 0 };
|
UINT dpiY{ 0 };
|
||||||
GetDpiForMonitor(outputDesc.Monitor, MDT_RAW_DPI, &dpiX, &dpiY);
|
|
||||||
UINT dpiXScaled{ 0 };
|
UINT dpiXScaled{ 0 };
|
||||||
UINT dpiYScaled{ 0 };
|
UINT dpiYScaled{ 0 };
|
||||||
GetDpiForMonitor(outputDesc.Monitor, MDT_EFFECTIVE_DPI, &dpiXScaled, &dpiYScaled);
|
|
||||||
|
// SHCore.dll is not available prior to Windows 8.1
|
||||||
|
HMODULE SHCoreDLL = LoadLibraryW(L"SHCore.dll");
|
||||||
|
if (SHCoreDLL) {
|
||||||
|
auto _GetDpiForMonitor = reinterpret_cast<decltype(GetDpiForMonitor)*>(GetProcAddress(SHCoreDLL, "GetDpiForMonitor"));
|
||||||
|
if (_GetDpiForMonitor) {
|
||||||
|
_GetDpiForMonitor(outputDesc.Monitor, MDT_RAW_DPI, &dpiX, &dpiY);
|
||||||
|
_GetDpiForMonitor(outputDesc.Monitor, MDT_EFFECTIVE_DPI, &dpiXScaled, &dpiYScaled);
|
||||||
|
}
|
||||||
|
FreeLibrary(SHCoreDLL);
|
||||||
|
}
|
||||||
|
|
||||||
// Current display mode
|
// Current display mode
|
||||||
DEVMODEW devMode;
|
DEVMODEW devMode;
|
||||||
|
|
Loading…
Reference in a new issue