用vc++6.0实现的基于mfc对话框的获取当前时间的源代码
1个回答
2011-07-28
展开全部
加载OnTimer消息
void CXXDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTime time;
time=CTime::GetCurrentTime();
m_strNowTime.Format("%d-%d-%d",time.GetYear(),time.GetMonth(),time.GetDay());
//m_strNowTime 你编辑框关联的成员变量-
KillTimer(nIDEvent);
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
void CXXDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTime time;
time=CTime::GetCurrentTime();
m_strNowTime.Format("%d-%d-%d",time.GetYear(),time.GetMonth(),time.GetDay());
//m_strNowTime 你编辑框关联的成员变量-
KillTimer(nIDEvent);
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
追问
没有错误,但是不显示,我那个窗口有背景,是不是被它覆盖了啊?谢谢!
追答
void CArrangedPictureDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTime time;
time=CTime::GetCurrentTime();
m_strNowTime.Format("%d-%d-%d",time.GetYear(),time.GetMonth(),time.GetDay());
KillTimer(nIDEvent);
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
int CArrangedPictureDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetTimer(1,1000,NULL);
return 0;
}
忘记没弄完--
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |