From 4e88d1d589ec31ba5e2e7bc9e65c6e363eb829fc Mon Sep 17 00:00:00 2001
From: LunarInvasion <236479497+LunarInvasion@users.noreply.github.com>
Date: Thu, 20 Nov 2025 15:48:10 +0000
Subject: [PATCH] Do not use the manifest setting as it prevents setting
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
The manifest has dpiAware set to True/PM (PerMonitor) and won't allow a change to PerMonitorV2 afterwards.
https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process
---
.../example_win32_opengl3.vcxproj | 12 ++++++++----
examples/example_win32_opengl3/main.cpp | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/examples/example_win32_opengl3/example_win32_opengl3.vcxproj b/examples/example_win32_opengl3/example_win32_opengl3.vcxproj
index 711ad9bff..319b5e3e9 100644
--- a/examples/example_win32_opengl3/example_win32_opengl3.vcxproj
+++ b/examples/example_win32_opengl3/example_win32_opengl3.vcxproj
@@ -100,7 +100,8 @@
Console
- PerMonitorHighDPIAware
+
+
@@ -117,7 +118,8 @@
Console
- PerMonitorHighDPIAware
+
+
@@ -139,7 +141,8 @@
Console
- PerMonitorHighDPIAware
+
+
@@ -167,7 +170,8 @@
Console
- PerMonitorHighDPIAware
+
+
diff --git a/examples/example_win32_opengl3/main.cpp b/examples/example_win32_opengl3/main.cpp
index 169e56437..4223c8f21 100644
--- a/examples/example_win32_opengl3/main.cpp
+++ b/examples/example_win32_opengl3/main.cpp
@@ -37,7 +37,7 @@ int main(int, char**)
{
// Make process DPI aware and obtain main monitor scale
// https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process
- // ImGui_ImplWin32_EnableDpiAwareness(); // This is already set in the manifest so the call will fail, but leaving it for completeness.
+ ImGui_ImplWin32_EnableDpiAwareness();
float main_scale = ImGui_ImplWin32_GetDpiScaleForMonitor(::MonitorFromPoint(POINT{ 0, 0 }, MONITOR_DEFAULTTOPRIMARY));
// Create application window