開啟了一個10ms的多媒體定時器,但是每過一段時間定時器就會超時好長時間
TIMECAPS tc;
if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR)
// Error; 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<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 "));
uj5u.com熱心網友回復:
直接用一個timer的定時器周期控制元件能解決問題么?uj5u.com熱心網友回復:
您說的是ON_WM_TIMER()的訊息定時器嗎,這個定時器時間不夠精確uj5u.com熱心網友回復:
百度搜相關關鍵字。提醒:Windows計時精度≈15ms
uj5u.com熱心網友回復:
那意思是不是說Windows無法使用高精度定時器(1ms)uj5u.com熱心網友回復:
直接在視窗中添加Timer訊息轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/14199.html
上一篇:文本框字體怎么修改
下一篇:MFC背景圖片
