每次进入程序~秒表就从0开始时计时(放在一lable中,格式0:0:0)~退出程序就归0大家提个思路~~能帮我那就更感谢了

解决方案 »

  1.   

    一个变量记录运行时间,初始化为0
    程序运行开始取系统时间GetCurrentTime(),后面用两次时间相减可以获得程序运行的时间
      

  2.   

    格式是0:0:0  
    是小时:分钟:秒
    还是分钟:秒:毫秒OnTimer()里CTime time = CTime::GetCurrentTime();
    CString strTime = time.Format("%H:%M:%S");
    label.SetWindowText(strTime);
      

  3.   

    是小时:分钟:秒
    我要实现功能是运行程序时,界面label中的秒表一直走~
    例如:一进程序秒表是0:0:0 过了一秒就变为0:0:1......
      

  4.   

    m_ntime = GetCurrentTime();
    SetTimer(1234,80,NULL);OnTimer(UINT nIDEvent) 
    {
    // TODO: Add your message handler code here and/or call default
    if(nIDEvent==1234)
    {
    int time =GetCurrentTime()-m_nrow;
    int m =time/60000;
    time %=60000;
    int s=time/1000;
    time %=1000; m_time.Format("%02d:%02d.:%d", m,s,time/100);
    }
    UpdateData(false);
    CDialog::OnTimer(nIDEvent);
    }
      

  5.   

    在OnTimer里弄一个变量,记录OnTimer调用的次数。
    然后根据此变量来格式化字符串