1.timeSetEvent方法的第一个参数,最长时间间隔不能超过1000s,即1000000毫秒,超过返回失败。
MMRESULT timeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent );参考:
http://blog.csdn.net/wangwb0820/article/details/45243055
http://www.aizhuanji.com/a/KVOX4yDW.html
typedef struct timecaps_tag { UINT wPeriodMin; UINT wPeriodMax; } TIMECAPS, *PTIMECAPS, *NPTIMECAPS, *LPTIMECAPS;
Members
-
wPeriodMin
-
The minimum supported resolution, in milliseconds.
wPeriodMax
-
The maximum supported resolution, in milliseconds.
timeGetDevCaps需要Winmm.lib,在properties->linker->input->Additional Dependencies出添加。
TIMECAPS tc;
if(timeGetDevCaps(&tc, sizeof(TIMECAPS))==TIMERR_NOERROR ){
UINT min = tc.wPeriodMin;
UINT max = tc.wPeriodMax;
printf("min: %u, max: %u", min, max);
}