From f5e3353f825d87e5ffd639c28cdf7ebffa725553 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 23 May 2023 22:57:23 -0500 Subject: [PATCH] Fix resolutions reported by dxgi-info.exe on high DPI systems --- tools/dxgi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/dxgi.cpp b/tools/dxgi.cpp index d368848f..613c9eaa 100644 --- a/tools/dxgi.cpp +++ b/tools/dxgi.cpp @@ -1,7 +1,8 @@ /** * @file tools/dxgi.cpp - * @brief todo + * @brief Displays information about connected displays and GPUs */ +#define WINVER 0x0A00 #include #include @@ -27,6 +28,9 @@ int main(int argc, char *argv[]) { HRESULT status; + // Set ourselves as per-monitor DPI aware for accurate resolution values on High DPI systems + SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + dxgi::factory1_t::pointer factory_p {}; status = CreateDXGIFactory1(IID_IDXGIFactory1, (void **) &factory_p); dxgi::factory1_t factory { factory_p };