work due to the incomplete implementation of some libraries regarding
Console Apps. The alternative multimedia timer timeSetEvent looks like
it will work but I'm having problems implementing it in my code. Can
someone post point me to an example of it's use (setup and response)?
Thanks!
Gary M. Trimble
Paolo Coletta
-----------------
#include <windows.h>
int main( int , char ** )
{
TIMECAPS tc;
timeGetDevCaps( &tc, sizeof( tc ) );
timeBeginPeriod( tc.wPeriodMin );
HANDLE hTimer = CreateEvent( NULL, FALSE, FALSE, NULL );
UINT uID = timeSetEvent( tc.wPeriodMin, 0, LPTIMECALLBACK( hTimer ), 0,
TIME_PERIODIC | TIME_CALLBACK_EVENT_SET );
while(true)
{
WaitForSingleObject( hTimer, INFINITE );
// Do something useful....
if( <<stop condition>> )
{
timeKillEvent( uID );
break;
}
}
timeEndPeriod( tc.wPeriodMin );
CloseHandle( hTimer );
return 0;
}