Resolve warning popup when GetDpiForWindow() is not available
The GetDpiForWindow() Win32 API was introduced in User32.dll with Windows 10. Since we have a fallback case when this API is not present, avoid popping up the wxWidgets warning. Furthermore, performance was improved by introducing a flag to prevent keep looking for GetDpiForWindow() on each call.
This commit is contained in:
parent
45e847702e
commit
a798474bdc
@ -289,10 +289,13 @@ private:
|
||||
wxASSERT(dpiVert);
|
||||
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
typedef HRESULT(WINAPI *GetDpiForWindow_t)(HWND);
|
||||
typedef UINT(WINAPI *GetDpiForWindow_t)(HWND);
|
||||
static bool s_checkedGetDpiForWindow = false;
|
||||
static GetDpiForWindow_t s_pfnGetDpiForWindow = NULL;
|
||||
if (!s_pfnGetDpiForWindow && s_dllUser32.IsLoaded())
|
||||
s_pfnGetDpiForWindow = (GetDpiForWindow_t)s_dllUser32.GetSymbol(wxT("GetDpiForWindow"));
|
||||
if (!s_checkedGetDpiForWindow && s_dllUser32.IsLoaded()) {
|
||||
s_pfnGetDpiForWindow = (GetDpiForWindow_t)s_dllUser32.RawGetSymbol(wxT("GetDpiForWindow"));
|
||||
s_checkedGetDpiForWindow = true;
|
||||
}
|
||||
|
||||
if (s_pfnGetDpiForWindow) {
|
||||
*dpiHorz = *dpiVert = s_pfnGetDpiForWindow(hWnd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user