Skip to content

Commit

Permalink
Windows GUI: Use older API for getting system DPI, update2
Browse files Browse the repository at this point in the history
Implement delayed loading of user32.dll and restore GetSystemDpiForProcess. Should work on Windows 7 to 11 now.
  • Loading branch information
cjee21 committed Jun 1, 2024
1 parent 80dc38b commit 01b7169
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Project/BCB/GUI/MediaInfo_GUI.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<Icon_MainIcon>..\..\..\Source\Resource\Image\MediaInfo.ico</Icon_MainIcon>
<ILINK_DelayLoadDll>user32.dll;$(ILINK_DelayLoadDll)</ILINK_DelayLoadDll>
</PropertyGroup>
<ItemGroup>
<LibFiles Condition="'$(Platform)'=='Win32'" Include="$(BDSLIB)\win32\release\wininet.lib">
Expand Down
2 changes: 1 addition & 1 deletion Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void __fastcall TMainF::GUI_Configure()
GetVersionEx(&osvi);
int DPI;
if (osvi.dwMajorVersion >= 10 && (osvi.dwMajorVersion > 10 || osvi.dwMinorVersion > 0 || osvi.dwBuildNumber >= 17134))
DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX); // GetSystemDpiForProcess(GetCurrentProcess());
DPI=GetSystemDpiForProcess(GetCurrentProcess());
else
DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX);
float DPIScale=static_cast<float>(DPI)/96;
Expand Down

0 comments on commit 01b7169

Please sign in to comment.