有人知道MFC里怎么修改系统时间呀,可以告诉我一下吗,最好有代码

解决方案 »

  1.   

    修改系统时间函数
    BOOL SetSystemTime(
      CONST SYSTEMTIME *lpSystemTime   // address of system time to set
    );
    时间结构体定义
     typedef struct _SYSTEMTIME {  // st 
        WORD wYear; 
        WORD wMonth; 
        WORD wDayOfWeek; 
        WORD wDay; 
        WORD wHour; 
        WORD wMinute; 
        WORD wSecond; 
        WORD wMilliseconds; 
    } SYSTEMTIME; 
    得到系统时间函数
    VOID GetSystemTime(
      LPSYSTEMTIME lpSystemTime   // address of system time structure
    );
      

  2.   

    调用API函数:
    BOOL SetSystemTime(
      CONST SYSTEMTIME *lpSystemTime   // address of system time to set
    );
    ///////以下代码把系统小时数设为20,
    ...
    SYSTEMTIME SystemTime;
    GetSystemTime(&SystemTime);
    SystemTime.wHour = 20;
    SetSystemTime(&SystemTime);
    ...