I have some problems using the multimedia timer.
The call to timeSetEvent returns an identifier to the timer, but the callback function is never called.
The same code seems to work well if you run it on a PC.
Any help would be greatly appreciated.
/per
void CMMTimerDemoDlg::OnButtonStartTimer()
{
// check the timer's capabilities
TIMECAPS timeCaps;
if ( timeGetDevCaps(&timeCaps, sizeof(timeCaps)) !=TIMERR_NOERROR){
AfxMessageBox(_T("Failed to get capabilities."));
return;
}
// set the period of the timer
m_uiPeriod = timeCaps.wPeriodMin;
if ( timeBeginPeriod(m_uiPeriod) != TIMERR_NOERROR) {
AfxMessageBox(_T("Failed to Begin Period."));
return;
}
// start the timer
m_uiTimer = timeSetEvent(
1000, // delay in ms
m_uiPeriod, // resolution
TimerProcedure, // callback procdure
NULL, // user data
TIME_PERIODIC); //
if (m_uiTimer == 0){
AfxMessageBox(_T("Failed to start timer."));
return;
}
}