diff --git a/src/client/main.cpp b/src/client/main.cpp index 5909e93c..193c7b59 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -174,13 +174,41 @@ namespace void enable_dpi_awareness() { const utils::nt::library user32{"user32.dll"}; - const auto set_dpi = user32 - ? user32.get_proc( - "SetProcessDpiAwarenessContext") - : nullptr; - if (set_dpi) + { - set_dpi(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + const auto set_dpi = user32 + ? user32.get_proc( + "SetProcessDpiAwarenessContext") + : nullptr; + if (set_dpi) + { + set_dpi(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + return; + } + } + + { + const utils::nt::library shcore{"shcore.dll"}; + const auto set_dpi = shcore + ? shcore.get_proc( + "SetProcessDpiAwareness") + : nullptr; + if (set_dpi) + { + set_dpi(PROCESS_PER_MONITOR_DPI_AWARE); + return; + } + } + + { + const auto set_dpi = user32 + ? user32.get_proc( + "SetProcessDPIAware") + : nullptr; + if (set_dpi) + { + set_dpi(); + } } } diff --git a/src/client/std_include.hpp b/src/client/std_include.hpp index a9c9d402..a29aa2a6 100644 --- a/src/client/std_include.hpp +++ b/src/client/std_include.hpp @@ -50,6 +50,7 @@ #include #include #include +#include // min and max is required by gdi, therefore NOMINMAX won't work #ifdef max