diff --git a/libraries/platform/src/platform/backend/WINPlatform.cpp b/libraries/platform/src/platform/backend/WINPlatform.cpp index 8c0bb1b9aa..2958374451 100644 --- a/libraries/platform/src/platform/backend/WINPlatform.cpp +++ b/libraries/platform/src/platform/backend/WINPlatform.cpp @@ -27,7 +27,6 @@ #include #pragma comment(lib, "dxgi.lib") #include -#pragma comment(lib, "Shcore.lib") #endif @@ -118,10 +117,19 @@ void WINInstance::enumerateGpusAndDisplays() { // Grab the dpi info for the monitor UINT dpiX{ 0 }; UINT dpiY{ 0 }; - GetDpiForMonitor(outputDesc.Monitor, MDT_RAW_DPI, &dpiX, &dpiY); UINT dpiXScaled{ 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(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 DEVMODEW devMode;