From ec23b445e98c56d68cbff6db2d00832280ae7d57 Mon Sep 17 00:00:00 2001 From: Alexander <0oktonion0@gmail.com> Date: Tue, 8 May 2018 18:49:11 +0300 Subject: [PATCH] fix for freezing on getting current window text --- src/windows/GetWindows.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/windows/GetWindows.cpp b/src/windows/GetWindows.cpp index d001e754..0b6a63b8 100644 --- a/src/windows/GetWindows.cpp +++ b/src/windows/GetWindows.cpp @@ -15,7 +15,14 @@ namespace Screen_Capture { { Window w; char buffer[sizeof(w.Name)]; - GetWindowTextA(hwnd, buffer, sizeof(buffer)); + { // exclude windows for current process + DWORD pid; + GetWindowThreadProcessId(hwnd, &pid); + if (pid != GetProcessId(GetCurrentProcess())) + { + GetWindowTextA(hwnd, buffer, sizeof(buffer)); + } + } srch *s = (srch *)lParam; std::string name = buffer; w.Handle = reinterpret_cast(hwnd);