#include <time.h>
//在case MSG_INITDIALOG:或者 case MSG_CREATE: 下創建計時器
SetTimer (hDlg, IDC_TIMER, 100);
//需要說明的是,SetTimer 的第三個參數用來指定定時器的間隔,默認以 10 毫秒爲單
位,取值 100 即 1 秒。
case MSG_TIMER:
/* 接收到定時器消息。
* 嚴格的程序還應該在這裏判斷 wParam 是否等於期望的定時器標識符,這裏是 _ID_TIMER。
*/
SetDlgItemText (hDlg, IDC_STATIC, mk_time (buff));
break;
static char* mk_time (char* buff)
{
//timer
time_t t;
struct tm * tm;
time (&t);
tm = localtime (&t);
sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
//滾動字幕
char *str="Welcome to industry and commerce banking terminal station!";
buff=str+countnumber;
countnumber++;
if(countnumber==strlen(str))
countnumber=0;
return buff;
}