mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 06:42:08 +00:00
optimized last commit to not retrieve the function repeatedly if it has already failed.
This commit is contained in:
parent
744e67e02b
commit
4aee4fd187
1 changed files with 5 additions and 3 deletions
|
@ -275,10 +275,12 @@ typedef UINT(WINAPI* GetDpiForWindow_t)(HWND);
|
|||
double Win32Window::GetDpiScale() const
|
||||
{
|
||||
static GetDpiForWindow_t pGetDpiForWindow = nullptr;
|
||||
if (!pGetDpiForWindow)
|
||||
static bool done = false;
|
||||
if (!done)
|
||||
{
|
||||
HMODULE hMod = LoadLibrary(TEXT("User32.dll"));
|
||||
pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
|
||||
HMODULE hMod = GetModuleHandleA("User32.dll");
|
||||
if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
|
||||
done = true;
|
||||
}
|
||||
|
||||
if (pGetDpiForWindow)
|
||||
|
|
Loading…
Reference in a new issue