实时时间显示

109 views 十月 26, 04 by Timothy

用计时器实现:
SetTimer(1, 1000, NULL);
然后在响应函数:
void CAlertDlg::OnTimer(UINT nIDEvent)
{
static CString strTemp;
COleDateTime dtTime;

// 刷新显示的时间
dtTime = COleDateTime::GetCurrentTime();
strTemp.Format(“现在时间 %02i:%02i:%02i “,
dtTime.GetHour(),
dtTime.GetMinute(),
dtTime.GetSecond());
GetDlgItem(IDC_CURTIME)->SetWindowText(strTemp); //IDC_CURTIME即为窗口显示时间的一个
//CEDIT类控件

}



你可能也对下列文章感兴趣

<

This entry does not have any comment... but you can be first.


Leave a Reply

(Ctrl+Enter)