引用: 引用 12 楼 xuefeng_baggio 的回复:
dwResult = WaitForMultipleObjects(7, &WaitEvents[0], FALSE, dwWaitTime);楼主还是看看程序,我的程序中等待7个events都是可以的!
这是可以的 ,一旦7个 event中有一个触发 WaitForMultipleObjects就会成功。
LZ是 要2个 都触发了 才WaitForMultipleObjects成功。WinCE下 并不能这么做。
可以参照下面这个。。MS社区上找的。
DWORD MyWaitForMultipleObjects(DWORD count, const HANDLE *lpHandles,
BOOL waitAll, DWORD ms)
{
#ifdef _WIN32_WCE
if (!waitAll)
return WaitForMultipleObjects(count, lpHandles, waitAll, ms);
else
{
// wait for each in turn. Note that this does not exactly simulate
// WaitForMultipleObjects, as each object will become signalled as
// soon as WaitForSingleObjects recognizes it, rather than all becoming
// signaled together as with WaitForMultipleObjects...
DWORD ret = WAIT_OBJECT_0;
for (DWORD n = 0;n < count;n++)
{
DWORD d;
d = WaitForSingleObject(lpHandles, ms);
if (WAIT_TIMEOUT == d)
{
ret = WAIT_TIMEOUT;
break;
}
else if (WAIT_ABANDONED == d)
{
ret = WAIT_ABANDONED_0 + n;
break;
}
}
return ret;
}
#else
return WaitForMultipleObjects(count, lpHandles, waitAll, ms);
#endif
}