没有收到 WM_DPICHANGED 通知
Not getting the WM_DPICHANGED notification
我有一个 Win32 应用程序,我在其中实施了 groupWndProc()
回调,我收到了 WM_DPICHANGED
以外的通知。
我连接了两台显示器:一台普通显示器和一台 4k 显示器。我希望在将应用程序从一台显示器移动到另一台显示器时收到通知。
使用 SetProcessDpiAwareness
和 Process_Per_Monitor_DPI_Aware
确保你的进程是 DPI 感知的,并且根据 the tutorial on msdn 你必须在创建你的 windows 之前调用它。使用 GetDpiForMonitor
.
查询 return 不同的 dpis 时确保您的显示器
或者将应用程序清单设置为 per this tutorial。将 dpiAware
元素添加到您的应用程序清单:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
并确保您的编译器包含清单:将清单文件添加到项目属性 -> 配置属性 -> 清单工具 -> 其他清单文件。
我有一个 Win32 应用程序,我在其中实施了 groupWndProc()
回调,我收到了 WM_DPICHANGED
以外的通知。
我连接了两台显示器:一台普通显示器和一台 4k 显示器。我希望在将应用程序从一台显示器移动到另一台显示器时收到通知。
使用 SetProcessDpiAwareness
和 Process_Per_Monitor_DPI_Aware
确保你的进程是 DPI 感知的,并且根据 the tutorial on msdn 你必须在创建你的 windows 之前调用它。使用 GetDpiForMonitor
.
或者将应用程序清单设置为 per this tutorial。将 dpiAware
元素添加到您的应用程序清单:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
并确保您的编译器包含清单:将清单文件添加到项目属性 -> 配置属性 -> 清单工具 -> 其他清单文件。