Skip to content

Commit b539843

Browse files
committed
jira: MS-202023
1 parent 8fb0aa5 commit b539843

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,18 @@ int CAgoraMutilVideoSourceDlg::StartMultiVideoSource()
294294
m_lstInfo.InsertString(m_lstInfo.GetCount() - 1, _T("start porcess success"));
295295

296296
m_HandleData.process_id = (unsigned long)dwProcessId;
297+
298+
int remainRetry = 10;
297299
do {
300+
Sleep(500);
298301
EnumWindows(EnumWindowsCallback, (LPARAM)(&m_HandleData));
299-
} while (!m_HandleData.best_handle);
302+
remainRetry--;
303+
} while (!m_HandleData.best_handle && remainRetry > 0);
304+
305+
if (!m_HandleData.best_handle) {
306+
m_lstInfo.InsertString(m_lstInfo.GetCount() - 1, _T("best handle not exists"));
307+
return -1;
308+
}
300309
m_WndScreenShare = m_HandleData.best_handle;
301310

302311
if (!IsWindow(m_WndScreenShare))

0 commit comments

Comments
 (0)