VC++時鐘函數
更新時間:2015年06月08日 10:03:29 投稿:hebedich
VC中提供了很多關于時間操作的函數,編寫程序時我們可以跟據定時的不同精度要求選擇不同的時間函數來完成定時和計時操作
時鐘的使用
1、聲明
復制代碼 代碼如下:
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、調用時鐘函數
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);
}
以上所述就是本文的全部內容了,希望大家能夠喜歡。
相關文章
C語言中getopt()函數和select()函數的使用方法
這篇文章主要介紹了C語言中getopt()函數和select()函數的使用方法,是C語言入門學習中的基礎知識,需要的朋友可以參考下2015-09-09

