SYSTEMTIME NowTime,SetTime;

SetTime.wHour = 15;
SetTime.wMinute = 20;
SetTime.wSecond = 0;
GetSystemTime(&NowTime); if ((NowTime.wHour==SetTime.wHour) && (NowTime.wMinute==SetTime.wMinute) && (NowTime.wSecond==SetTime.wSecond))
AfxMessageBox("Seccess!");我是在基本对话框里的OnInitDialog()写的这些代码
那为什么到时间到了15:20确没有反应

解决方案 »

  1.   

    当然不行了据我所知:得到当前时间用GetCurrentTime
      

  2.   

    我去掉楼上这句也没有反应好象没有GetCurrentTime这个函数吧
      

  3.   

    看看Msdn吧!
    The GetSystemTime function retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC)CTime::GetCurrentTime 
    static CTime PASCAL GetCurrentTime( );ResReturns a CTime object that represents the current time..
      

  4.   

    哎,当然没反映了
    你又没有触发这个事件亚
    首先,你要用SetTimer();
    这个函数可以设定一个时间间隔;
    SetTimer(1,500, 0);
    其中1为标示符,没什么大关系,只有当用到好几次settimer()时才有区分的作用。
    500表示,在settimer()以后每500毫秒触发一次OnTimer();
    0,别管他对于你这个程序
    //呵呵,你写的代码我给的
    你应该把这个时间间隔写的小一点,这样程序每隔一段时间就判断是否
    等于15:20对了,还要做一件事,就是killTimer()
    当你不用时,删掉这个
    时间触发器,如下所示if ((NowTime.wHour==SetTime.wHour) && (NowTime.wMinute==SetTime.wMinute) && (NowTime.wSecond==SetTime.wSecond))
    {
    ...
    //do your things
    KillTimer(m_nTimer);//m_nTimer是SetTimer(1,500,0)的返回值
      

  5.   

    SYSTEMTIME NowTime,SetTime;

    SetTime.wHour = 15;
    SetTime.wMinute = 20;
    SetTime.wSecond = 0;

    while((NowTime.wHour!=SetTime.wHour) || (NowTime.wMinute!=SetTime.wMinute) || (NowTime.wSecond!=SetTime.wSecond)){
    GetSystemTime(&NowTime);
    AfxMessageBox("Seccess!");
      

  6.   

    问给一个问题
    系统时间和本地时间有什么区别呢
    SYSTEMTIME   pSystemtime;
    ::GetLocalTime(&pSystemtime);
    //////////////////////////
    SYSTEMTIME  CurrTime;
    GetLocalTime(&CurrTime);