handle = CreateEvent(NULL, true, false, NULL);
UINT nID = timeSetEvent(timerInterval, 5, (LPTIMECALLBACK)utilTimerProc, (DWORD_PTR)handle, TIME_PERIODIC);
void* CALLBACK utilTimerProc(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dwl, DWORD dw2)
{
SetEvent((HANDLE)dwUser);
return NULL;
}
UINT nID = timeSetEvent(timerInterval, 5, (LPTIMECALLBACK)utilTimerProc, (DWORD_PTR)handle, TIME_PERIODIC);
void* CALLBACK utilTimerProc(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dwl, DWORD dw2)
{
SetEvent((HANDLE)dwUser);
return NULL;
}
MSG msg = {0};
WaitForSingleObject(handle, INFINITE);
ResetEvent(handle);
if( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
if(msg.wParam == VK_ESCAPE)
{
break;
}
DispatchMessage(&msg);
}
timeKillEvent(nID);
CloseHandle(handle);