SDK也有定时器SetTimer The SetTimer function creates a timer with the specified time-out value. UINT SetTimer( HWND hWnd, // handle of window for timer messages UINT nIDEvent, // timer identifier UINT uElapse, // time-out value TIMERPROC lpTimerFunc // address of timer procedure );该函数在sdk 也可用
CTimeSpan 就是时间间隔类
tm1 = ...int iMinutes = (CTime::GetCurrentTime() - tm1).GetTotalMinutes();
//iMinutes就是 当前时间 和 tm1的分钟差值
The SetTimer function creates a timer with the specified time-out value. UINT SetTimer(
HWND hWnd, // handle of window for timer messages
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
);该函数在sdk 也可用
你可以一位一位的算
把两个SYSTEMTIME一位一位的减
(tmNow.wHours - tmOld.wHours) * 60
+ (tmNow.wDay - tmOld.wDay) * 24 * 60
+ ...
就得到分钟差了
time_t now, after_5_min;
...
time(&now);
after_5_min = now + 5 * 60;
....计时器过程中
time(&now);
if(now >= after_5_min)
{
// 已经过了5分钟
}
每次减去最开始的GetTickCount返回的值.得到的就是运行的毫秒数.