VC++時鐘函數(shù)
更新時間:2015年06月08日 10:03:29 投稿:hebedich
VC中提供了很多關(guān)于時間操作的函數(shù),編寫程序時我們可以跟據(jù)定時的不同精度要求選擇不同的時間函數(shù)來完成定時和計時操作
時鐘的使用
1、聲明
復(fù)制代碼 代碼如下:
VOID CALLBACK playproc(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
2、聲明一個時鐘句柄
const ID=111;
3、調(diào)用時鐘函數(shù)
SetTimer( ID,1500,&playproc);
KillTimer( ID);
一般使用判斷邏輯:
VOID CALLBACK playproc(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time</span>
)
const ID=111;
void XXXXX()
{
UpdateData(true);
if (m_?)
{
SetTimer(ID,1500,&playproc);
}
else KillTimer(ID);
}
以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。
相關(guān)文章
C語言中g(shù)etopt()函數(shù)和select()函數(shù)的使用方法
這篇文章主要介紹了C語言中g(shù)etopt()函數(shù)和select()函數(shù)的使用方法,是C語言入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下2015-09-09

