用GetSystemTime函数,比较两次所取得的时间差即可。

解决方案 »

  1.   

    在程序初始化时调用SetTimer,在WM_TIMER映射消息中中止程序
      

  2.   

    SetTimer(1,5*1000/*以毫秒为单位*/,NULL);
    OnTimer(UINT nIDEvent) 
    {
      exit(0);/*or SendMessage(WM_CLOSE,0,0);*/}
      

  3.   

    CTime timestart;     //开始时间
    CTimeSpan timespan;  //时间间隔
    CTime timenow;       //现在时间
    int timejg;
    timestart=CTime::GetCurrentTime();
    timenow=CTime::GetCurrentTime();
    timespan=timenow-timestart;
    timejg=timespan.GetMinutes();
    if(timejg==50)
        exit(0);
      

  4.   

    在程序初始化时int i=0;
    SetTimer(设5秒)
    在WM_TIMER映射消息中当i*5==5*60时中止程序 
      

  5.   

    在Process一開始記錄timeGetTime, 在主消息Loop中找時機(如IDLE), 計算timeGetTime()-OldtimeGetTime的值是否>= 5*60*1000