From a6c941ac2c5e0b88d827c6d5c753cce3021e9e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondrej=20Baranovi=C4=8D?= Date: Thu, 7 Nov 2024 22:22:02 +0100 Subject: [PATCH] Do not load GetWindowDpiAwarenessContext until its needed Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- src/display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.c b/src/display.c index 5babd4f2a..353d52396 100644 --- a/src/display.c +++ b/src/display.c @@ -359,9 +359,9 @@ PyImaging_GrabScreenWin32(PyObject *self, PyObject *args) { user32 = LoadLibraryA("User32.dll"); SetThreadDpiAwarenessContext_function = (Func_SetThreadDpiAwarenessContext )GetProcAddress(user32, "SetThreadDpiAwarenessContext"); - GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext - )GetProcAddress(user32, "GetWindowDpiAwarenessContext"); if (SetThreadDpiAwarenessContext_function != NULL) { + GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext + )GetProcAddress(user32, "GetWindowDpiAwarenessContext"); if (screens == -1 && GetWindowDpiAwarenessContext_function != NULL) { dpiAwareness = GetWindowDpiAwarenessContext_function(wnd);