SetWaitableTimer The SetWaitableTimer function activates the specified "waitable" timer. When the due time arrives, the timer is signaled and the thread that set the timer calls the optional completion routine.BOOL SetWaitableTimer( HANDLE hTimer, // handle to a timer object const LARGE_INTEGER *pDueTime, // when timer will become signaled LONG lPeriod, // periodic timer interval PTIMERAPCROUTINE pfnCompletionRoutine, // completion routine LPVOID lpArgToCompletionRoutine, // data for completion routine BOOL fResume // flag for resume state );
线程跟onTimer没关系
1)你在OnTimer里创建线程,就像你说的那样
2)在formView初始化的地方创建线程,线程里while循环,处理完数据Sleep一段时间,然后再继续。
The SetWaitableTimer function activates the specified "waitable" timer. When the due time arrives, the timer is signaled and the thread that set the timer calls the optional completion routine.BOOL SetWaitableTimer(
HANDLE hTimer, // handle to a timer object
const LARGE_INTEGER *pDueTime, // when timer will become signaled
LONG lPeriod, // periodic timer interval
PTIMERAPCROUTINE pfnCompletionRoutine, // completion routine
LPVOID lpArgToCompletionRoutine, // data for completion routine
BOOL fResume // flag for resume state
);
这个可是定时
Sleep误差很大
CWinThread *AfxBeginThread=(Thread1,NULL,THREAD_PRIORITY_NORMAL,0,0,NULL);
static UINT Thread1();