开启一个定时器,周期为1000ms,在消息响应函数OnTime中添加以下代码:
CTime cTime;
CString strTime;
cTime=CTime::GetCurrentTime();
strTime.Format("%d/%d/%d
%d:%d:%d",
cTime.GetYear(),
cTime.GetMonth(),
cTime.GetDay(),
cTime.GetHour(),
cTime.GetMinute(),
cTime.GetSecond());
m_ctrDisplay.SetWindowText(strTime);