工作原因,需要维护一款VS2008 SP1开发的MFC项目,
发现WIN10高分辨率下显示模糊,不考虑升级VC版本情况下尝试解决
新版本VC中Manifest Tool
>Input and Output
内有一项dpiAware
,应该是加了对应清单项,
尝试添加一下内容到hdpi.xml
并Manifest Tool
>Input and Output
>Additional Manifest Files
添加hdpi.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
报错manifest authoring warning 81010002: Unrecognized Element "application" in namespace "urn:schemas-microsoft-com:asm.v3".
参考https://social.msdn.microsoft.com/Forums/vstudio/en-US/ab815aa4-bd4d-4ab2-8826-fa20b0816372/how-to-make-application-to-fit-dpi-setting
应该是mt.ex版本问题
程序入口调用以下函数
void _DpiNohelp()
{
HMODULE m = LoadLibrary(L"shcore.dll");
if(m) {
typedef HRESULT (WINAPI *FSetProcessDpiAwareness)(int value);
void* proc = GetProcAddress(m, "SetProcessDpiAwareness");
if(proc) ((FSetProcessDpiAwareness)proc)(2);
FreeLibrary(m);
}
}
原文:https://www.cnblogs.com/wuyaSama/p/11484558.html