15,471
社区成员
发帖
与我相关
我的任务
分享
HANDLE t[2];
CWinThread* t1 = AfxBeginThread(myThread, this);
t1->m_bAutoDelete = FALSE;
CWinThread* t2 = AfxBeginThread(myThread2, this);
t2->m_bAutoDelete = FALSE;
t[1] = t1->m_hThread;
t[2] = t2->m_hThread;
long hu = WaitForMultipleObjects(2, t, TRUE, INFINITE);
int errNum;
switch(hu)
{
case WAIT_TIMEOUT:
AfxMessageBox("超时");
break;
case WAIT_FAILED:
errNum = GetLastError();
strInfo.Format("等待失败:%d", errNum);
AfxMessageBox(strInfo);
break;
default:
{
AfxMessageBox("成功");
}
}
CloseHandle(t[1]);
CloseHandle(t[2]);
delete t1;
delete t2;