Old VC project dpiAware support

Due

Work reasons, need to maintain a VS2008 SP1 MFC project development,
findings show that fuzzy WIN10 high resolution, without considering the VC version upgrade to try to resolve the situation

try

The new version of the VC Manifest Tool> Input and Outputinner one dpiAware, should be added to the list of items correspond,
try to add content to it hdpi.xmland Manifest Tool> Input and Output> Additional Manifest FilesAddhdpi.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>

Error manifest authoring warning 81010002: Unrecognized Element "application" in namespace "urn:schemas-microsoft-com:asm.v3".
reference https://social.msdn.microsoft.com/Forums/vstudio/en-US/ab815aa4-bd4d-4ab2-8826-fa20b0816372/how-to-make-application-to-fit-dpi-setting
should be mt.ex version of the problem
FAILED.

solve

Add the following code program starts

    HMODULE mShcore = LoadLibrary(L"Shcore.dll");
    if(mShcore) {
        typedef HRESULT (WINAPI *TSetProcessDpiAwareness)(int value); 
        TSetProcessDpiAwareness fn = (TSetProcessDpiAwareness)GetProcAddress(mShcore, "SetProcessDpiAwareness");
        if(fn) fn(2);
        FreeLibrary(mShcore);
    }

Guess you like

Origin www.cnblogs.com/wuyaSama/p/11484558.html
Old