1、界面:
2、控件的ID设置
3、功能实现
(1)、日期和时间的显示
类向导中找到WM_TIMER添加OnTimer函数,设置两个计时器,分别显示日期和时间;
void CButtonandlistDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CString m_strTime,m_strDate ;
CTime theTime,theDate;
int y,m,d,h,min,s;
switch(nIDEvent)
{
case 1:
{
theDate = CTime::GetCurrentTime();
/*y=theDate.GetYear();
m=theDate.GetMonth();
d=theDate.GetDay();*/
m_strDate =theDate.Format("%Y/%m/%d ");
SetDlgItemText(IDC_DATE_EDIT,m_s