From c606869d419c6d0718d5b3ced3c9b8d71d8b7b43 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Wed, 29 Nov 2017 21:21:25 +0100 Subject: [PATCH] changed window name of the OBS window to "OBS" "Advanced Scene Switcher" didn't make sense for the whole of OBS --- advanced-scene-switcher-win.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/advanced-scene-switcher-win.cpp b/advanced-scene-switcher-win.cpp index 0523b7f4..89f836de 100644 --- a/advanced-scene-switcher-win.cpp +++ b/advanced-scene-switcher-win.cpp @@ -61,14 +61,19 @@ void GetWindowList(vector& windows) void GetCurrentWindowTitle(string& title) { HWND window = GetForegroundWindow(); - DWORD id; - GetWindowThreadProcessId(window, &id); + DWORD pid; + DWORD thid; + thid = GetWindowThreadProcessId(window, &pid); /*GetWindowText will freeze if the control it is reading was created in another thread. It does not directly read the control.Instead, it waits for the thread that created the control to process a WM_GETTEXT message. So if that thread is frozen in a WaitFor... call you have a deadlock.*/ - if (id == GetCurrentProcessId()) { - title = ""; + DWORD this_thid = GetCurrentThreadId(); + //wstring message = L"\nUI id " + to_wstring(thid) + L", this_th_id " + to_wstring(this_thid) + L"\n"; + //OutputDebugString(message.c_str()); + //if (this_thid == thid) { + if (GetCurrentProcessId() == pid) { + title = "OBS"; return; } GetWindowTitle(window, title);