From b4749b1f8664d169238355b520d549d1dcb46f08 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 21 Aug 2025 16:55:58 +0100 Subject: [PATCH] Windowing: Avoid dynamically loading SetProcessDPIAware, which is always present on Vista --- modules/juce_gui_basics/native/juce_Windowing_windows.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index 102ed3bba2..a03504cbcf 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -354,7 +354,6 @@ static void checkForPointerAPI() } //============================================================================== -using SetProcessDPIAwareFunc = BOOL (WINAPI*) (); using SetProcessDPIAwarenessContextFunc = BOOL (WINAPI*) (DPI_AWARENESS_CONTEXT); using SetProcessDPIAwarenessFunc = HRESULT (WINAPI*) (DPI_Awareness); using SetThreadDPIAwarenessContextFunc = DPI_AWARENESS_CONTEXT (WINAPI*) (DPI_AWARENESS_CONTEXT); @@ -366,7 +365,6 @@ using GetThreadDPIAwarenessContextFunc = DPI_AWARENESS_CONTEXT (WINAPI*) using GetAwarenessFromDpiAwarenessContextFunc = DPI_Awareness (WINAPI*) (DPI_AWARENESS_CONTEXT); using EnableNonClientDPIScalingFunc = BOOL (WINAPI*) (HWND); -static SetProcessDPIAwareFunc setProcessDPIAware = nullptr; static SetProcessDPIAwarenessContextFunc setProcessDPIAwarenessContext = nullptr; static SetProcessDPIAwarenessFunc setProcessDPIAwareness = nullptr; static SetThreadDPIAwarenessContextFunc setThreadDPIAwarenessContext = nullptr; @@ -381,8 +379,6 @@ static bool hasCheckedForDPIAwareness = false; static void loadDPIAwarenessFunctions() { - setProcessDPIAware = (SetProcessDPIAwareFunc) getUser32Function ("SetProcessDPIAware"); - constexpr auto shcore = "SHCore.dll"; LoadLibraryA (shcore); const auto shcoreModule = GetModuleHandleA (shcore); @@ -428,7 +424,7 @@ static void setDPIAwareness() && SUCCEEDED (setProcessDPIAwareness (DPI_Awareness::DPI_Awareness_System_Aware))) return; - NullCheckedInvocation::invoke (setProcessDPIAware); + SetProcessDPIAware(); } static bool isPerMonitorDPIAwareProcess()