mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
- dynamically import GetDpiForWindow from USER32.dll, else return a default value
This commit is contained in:
parent
1fe6556e6e
commit
744e67e02b
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