Friday, November 6, 2009

How to Get System Time in VC++

How can we get system time ?

void CTimeDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CTime t=CTime::GetCurrentTime();

CString str;
str.Format("%d:%d:%d",t.GetHour(),t.GetMinute(),t.GetSecond());

this->SetWindowText(str);
}

No comments:

Post a Comment