We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0da6e76 commit d8bd918Copy full SHA for d8bd918
libraries/ZWidget/src/window/win32/win32window.cpp
@@ -275,10 +275,12 @@ typedef UINT(WINAPI* GetDpiForWindow_t)(HWND);
275
double Win32Window::GetDpiScale() const
276
{
277
static GetDpiForWindow_t pGetDpiForWindow = nullptr;
278
- if (!pGetDpiForWindow)
+ static bool done = false;
279
+ if (!done)
280
- HMODULE hMod = LoadLibrary(TEXT("User32.dll"));
281
- pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
+ HMODULE hMod = GetModuleHandleA("User32.dll");
282
+ if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
283
+ done = true;
284
}
285
286
if (pGetDpiForWindow)
0 commit comments