diff options
Diffstat (limited to 'src/video/win32_v.cpp')
-rw-r--r-- | src/video/win32_v.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 9c5714786..35a995b99 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -956,10 +956,11 @@ float VideoDriver_Win32Base::GetDPIScale() static bool init_done = false; if (!init_done) { init_done = true; - - _GetDpiForWindow = (PFNGETDPIFORWINDOW)GetProcAddress(GetModuleHandle(L"User32"), "GetDpiForWindow"); - _GetDpiForSystem = (PFNGETDPIFORSYSTEM)GetProcAddress(GetModuleHandle(L"User32"), "GetDpiForSystem"); - _GetDpiForMonitor = (PFNGETDPIFORMONITOR)GetProcAddress(LoadLibrary(L"Shcore.dll"), "GetDpiForMonitor"); + static DllLoader _user32(L"user32.dll"); + static DllLoader _shcore(L"shcore.dll"); + _GetDpiForWindow = _user32.GetProcAddress("GetDpiForWindow"); + _GetDpiForSystem = _user32.GetProcAddress("GetDpiForSystem"); + _GetDpiForMonitor = _shcore.GetProcAddress("GetDpiForMonitor"); } UINT cur_dpi = 0; |