怎样定时修改系统时间?
就是说,到如果要每天到下午6点,就把时间改为6:00:04,怎么做?
是不是要调用windows的api函数?

解决方案 »

  1.   

    GetSystemTime//得到时间
    SetSystemTime//修改时间
      

  2.   

    有人做过类似的东东吗?能否给look一下?多谢了!
      

  3.   

    The following example sets the system time using the SetSystemTime function.// SetNewTime - sets system time
    // Return value - TRUE if successful, FALSE otherwise
    // hour     - new hour (0-23)
    // minutes  - new minutes (0-59)BOOL SetNewTime(WORD hour, WORD minutes)
    {
        SYSTEMTIME st;
        char *pc;    GetSystemTime(&st);       // gets current time
        st.wHour = hour;          // adjusts hours 
        st.wMinute = minutes;     // and minutes
        if (!SetSystemTime(&st))  // sets system time
            return FALSE;
        return TRUE;
    }