diff --git a/DDrawCompat/Dll/DllMain.cpp b/DDrawCompat/Dll/DllMain.cpp index ebddade..e41add3 100644 --- a/DDrawCompat/Dll/DllMain.cpp +++ b/DDrawCompat/Dll/DllMain.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -177,6 +178,21 @@ namespace Compat::Log() << "Environment variable " << var << " = \"" << value << '"'; } + void setDpiAwareness() + { + HMODULE shcore = LoadLibrary("shcore"); + if (shcore) + { + auto setProcessDpiAwareness = reinterpret_cast( + Compat::getProcAddress(shcore, "SetProcessDpiAwareness")); + if (setProcessDpiAwareness && SUCCEEDED(setProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE))) + { + return; + } + } + SetProcessDPIAware(); + } + template void suppressEmulatedDirectDraw(Param) { @@ -256,7 +272,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) SetProcessPriorityBoost(GetCurrentProcess(), disablePriorityBoost); SetProcessAffinityMask(GetCurrentProcess(), 1); timeBeginPeriod(1); - SetProcessDPIAware(); + setDpiAwareness(); SetThemeAppProperties(0); Win32::MsgHooks::installHooks();