From 5b1a07607ba593050e37598f731f833b6faabee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 7 Sep 2022 00:32:33 +0200 Subject: Fix WithNextWindow bug. --- c/win32.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'c/win32.cpp') diff --git a/c/win32.cpp b/c/win32.cpp index 2ecea50..fa5116d 100644 --- a/c/win32.cpp +++ b/c/win32.cpp @@ -30,8 +30,10 @@ void WithNextWindow(void (*proc)(HWND)) * that static storage must be used, as SetWindowHookEx cannot * accept a capturing lambda as the hook procedure. */ - static thread_local auto procNext = proc; - static thread_local HHOOK hHook = Require(SetWindowsHookExW(WH_CBT, [](const int nCode, + static thread_local void (*procNext)(HWND); + static thread_local HHOOK hHook; + procNext = proc; + hHook = Require(SetWindowsHookExW(WH_CBT, [](const int nCode, const WPARAM wParam, const LPARAM lParam) -> LRESULT CALLBACK { if (nCode == HCBT_CREATEWND) { -- cgit v1.2.3