diff options
author | glx22 <glx@openttd.org> | 2021-05-14 15:26:03 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-06-10 23:17:29 +0200 |
commit | 744a9e474575af90935807620bff860c02559d76 (patch) | |
tree | 1c9dc114fb609d12cc9faffd16e88f177696dd13 /src/video | |
parent | 15f66329c28cb0aa3107dbb8da71281b1501be6b (diff) | |
download | openttd-744a9e474575af90935807620bff860c02559d76.tar.xz |
Codechange: [WIN32] Add a wrapper around GetProcAddress()
Diffstat (limited to 'src/video')
-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; |