evc 中同步的问题
下面的程序我把它该成vc程序可以在windows 2000上运行,但是在Smartphone 2003和Emulator 上运行不了,出现wait_failed错误,错误号87,那位指教一下.
#include <windows.h>
#include <Winbase.h>
#include <memory.h>
#include <notify.h>
#include <winioctl.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int CmdShow)
{
HANDLE hEvents[2];
DWORD dwWaitResult;
DWORD error=0;
hEvents[1] = CreateEvent(NULL, FALSE, TRUE, L"DDD_READ_EVENT");
hEvents[0] = CreateEvent(NULL, TRUE, TRUE, L"DDD_WRITE_EVENT");
dwWaitResult = WaitForMultipleObjects(2, hEvents, TRUE, 6000);
switch(dwWaitResult)
{
case WAIT_OBJECT_0:
MessageBox(NULL, L"Read successfully", L"Info", MB_OK);
break;
case WAIT_OBJECT_0+1:
MessageBox(NULL, L"Read successfully", L"Info1", MB_OK);
break;
case WAIT_FAILED:
error = GetLastError();
MessageBox(NULL, L"Wait_failed", L"Info", MB_OK);
break;
case WAIT_TIMEOUT:
MessageBox(NULL, L"Wait_Timeout", L"Info", MB_OK);
break;
default:
MessageBox(NULL, L"Other info", L"Info", MB_OK);
break;
}
SetEvent(hEvents[0]);
return 0;
}