mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-15 00:42:20 +00:00
- dynamically import GetDpiForWindow from USER32.dll, else return a default value
This commit is contained in:
parent
38cff89a23
commit
51b3e4b335
1 changed files with 12 additions and 1 deletions
|
@ -271,9 +271,20 @@ int Win32Window::GetPixelHeight() const
|
|||
return box.bottom;
|
||||
}
|
||||
|
||||
typedef UINT(WINAPI* GetDpiForWindow_t)(HWND);
|
||||
double Win32Window::GetDpiScale() const
|
||||
{
|
||||
return GetDpiForWindow(WindowHandle) / 96.0;
|
||||
static GetDpiForWindow_t pGetDpiForWindow = nullptr;
|
||||
if (!pGetDpiForWindow)
|
||||
{
|
||||
HMODULE hMod = LoadLibrary(TEXT("User32.dll"));
|
||||
pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
|
||||
}
|
||||
|
||||
if (pGetDpiForWindow)
|
||||
return pGetDpiForWindow(WindowHandle) / 96.0;
|
||||
else
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
std::string Win32Window::GetClipboardText()
|
||||
|
|
Loading…
Reference in a new issue