在CMainFrame构造函数中添加
CMainFrame::CMainFrame()
{
    // TODO: add member initialization code here
    SetTimer(1,1000);
}添加WM_TIMER消息处理函数
void CMainFrame::OnTimer(UINT nIDEvent) 
{
   // TODO: Add your message handler code here and/or call default
   CClientDC dc(this); 
   CString sTime;
   SYSTEMTIME systime;
   GetSystemTime(&systime);
   sTime.Format("%u:%u:%u",systime.wHour, systime.wMinute, systime.wSecond);
   CFrameWnd::OnTimer(nIDEvent);
}

解决方案 »

  1.   

    Sorry:
    在CMainFrame构造函数中添加
    CMainFrame::CMainFrame()
    {
        // TODO: add member initialization code here
        SetTimer(1,1000);
    }添加WM_TIMER消息处理函数
    void CMainFrame::OnTimer(UINT nIDEvent) 
    {
       // TODO: Add your message handler code here and/or call default
       CClientDC dc(this); 
       CString sTime;
       SYSTEMTIME systime;
       GetSystemTime(&systime);
       sTime.Format("%u:%u:%u",systime.wHour, systime.wMinute, systime.wSecond);
       dc.TextOut(10,10,sTime);
       CFrameWnd::OnTimer(nIDEvent);
    }
      

  2.   

    在CMainFrame::OnCreate()中加入
    SetTimer(1,1000,NULL);