mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-28 04:06:27 -05:00
add 'OBS' entry to GetWindowList() on Windows(#76)
This commit is contained in:
@@ -89,6 +89,9 @@ void GetWindowList(QStringList &windows)
|
||||
for (auto window : w) {
|
||||
windows << QString::fromStdString(window);
|
||||
}
|
||||
|
||||
// Add entry for OBS Studio itself, see GetCurrentWindowTitle
|
||||
windows << QString("OBS");
|
||||
}
|
||||
|
||||
void GetCurrentWindowTitle(std::string &title)
|
||||
@@ -97,10 +100,10 @@ void GetCurrentWindowTitle(std::string &title)
|
||||
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.*/
|
||||
// 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 (GetCurrentProcessId() == pid) {
|
||||
title = "OBS";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user