diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index f898fa3c2060..89b44e74add8 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -5336,19 +5336,14 @@ bool juce::detail::WindowingHelpers::isWindowOnCurrentVirtualDesktop (void* x) if (x == nullptr) return false; - static auto* desktopManager = [] - { - JuceIVirtualDesktopManager* result = nullptr; - - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token") + JuceIVirtualDesktopManager* desktopManager = nullptr; - if (SUCCEEDED (CoCreateInstance (__uuidof (JuceVirtualDesktopManager), nullptr, CLSCTX_ALL, IID_PPV_ARGS (&result)))) - return result; + JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token") - JUCE_END_IGNORE_WARNINGS_GCC_LIKE + if (FAILED (CoCreateInstance (__uuidof (JuceVirtualDesktopManager), nullptr, CLSCTX_ALL, IID_PPV_ARGS (&desktopManager)))) + return true; - return static_cast (nullptr); - }(); + JUCE_END_IGNORE_WARNINGS_GCC_LIKE BOOL current = false;