Skip to content

Commit

Permalink
Merge pull request MediaArea#859 from cjee21/DPI-fix
Browse files Browse the repository at this point in the history
Windows GUI: Use older API for getting system DPI
  • Loading branch information
JeromeMartinez authored May 31, 2024
2 parents fb4fe15 + 4cb609f commit 38aa66c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,16 @@ __fastcall TMainF::TMainF(TComponent* Owner)
void __fastcall TMainF::GUI_Configure()
{
//Hard coded
float DPIScale=static_cast<float>(GetSystemDpiForProcess(GetCurrentProcess()))/96;
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
int DPI;
if (osvi.dwMajorVersion >= 10 && (osvi.dwMajorVersion > 10 || osvi.dwMinorVersion > 0 || osvi.dwBuildNumber >= 17134))
DPI=GetSystemDpiForProcess(GetCurrentProcess());
else
DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX);
float DPIScale=static_cast<float>(DPI)/96;
float ScaledScreenWidth=Screen->Width/DPIScale;
float ScaledScreenHeight=Screen->Height/DPIScale;
Width=500;
Expand Down

0 comments on commit 38aa66c

Please sign in to comment.