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);