TIMECAPS tc.
If (timeGetDevCaps (& amp; Tc, sizeof (TIMECAPS))!=TIMERR_NOERROR)
//the Error; The application can 't continue.
WTimerRes=min (Max (tc wPeriodMin, TARGET_RESOLUTION), tc wPeriodMax);
TimeBeginPeriod (wTimerRes);
TimeSetEventRslt=timeSetEvent (
10,//delay
WTimerRes,//resolution (global variable)
LPTIMECALLBACK TenMsecTimer,//callback function
WTimerRes/* reinterpret_cast & lt; DWORD> (this) */,//user data
TIME_PERIODIC/* | TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS */);//periodic call to callback func
If (timeSetEventRslt==NULL) MessageBox (_T (" TimeSetEvent fail. Maybe delay is not in the range of the minimum and maximum "));
CodePudding user response:
Directly with a timer timer cycle control can solve the problem?CodePudding user response:
You have said is ON_WM_TIMER () the news of the timer, this timer time not precise enoughCodePudding user response:
Baidu search relevant keywords,Remind: 15 ms Windows timing precision material
CodePudding user response:
Mean to say that the Windows will not be able to use high precision timer (1 ms)CodePudding user response:
Add the Timer messages directly in the window