前提・実現したいこと
win7/8/8.1/10向けのアプリケーションを開発しています。vb.netで作成したプログラムからC++で作成したDLLを呼んでおり、DLLで画面表示などを行っています。このDLLで行っている画面表示で、Win10の場合はマルチモニタDPI、Win8,7の場合はDPI Awareにしたいと考えております。
発生している問題・エラーメッセージ
DLLでSetThreadDpiAwarenessContextを呼ぶとwin7でDLLの読み込みに失敗してしまいます。
試したこと
以下のようなDeclareDPIAware.manifestを作成し、DLLのプロジェクトに追加のマニュフェストファイルとして設定しましたが、マルチモニタDPIになりませんでした。
XML
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> 3 <assemblyIdentity type="win32" name="MyApplication" version="1.0.0.0" processorArchitecture="amd64"/> 4 5 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> 6 <security> 7 <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> 8 <requestedExecutionLevel level="asInvoker" uiAccess="false" /> 9 </requestedPrivileges> 10 </security> 11 </trustInfo> 12 13 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 14 <application> 15 <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> 16 </application> 17 </compatibility> 18 19 <asmv3:application> 20 <asmv3:windowsSettings> 21 <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 --> 22 <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported --> 23 <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling> <!-- enables GDI DPI scaling --> 24 </asmv3:windowsSettings> 25 </asmv3:application> 26</assembly>
DLLのソース内でSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)すると、マルチモニタDPIにすることができました。
補足情報(FW/ツールのバージョンなど)
Visual Studio 2017です。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/03 14:01