mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
optimized last commit to not retrieve the function repeatedly if it has already failed.
This commit is contained in:
parent
51b3e4b335
commit
260c019301
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