开发者

Change local time by C++ program

Now in my country the local time is:

3:43 PM   

Can I write program in C++ to change th开发者_C百科e time on a Windows 7 system to another time?

For example set it to 5:00 PM (increase) or decrease it?


In VC++ you can try. Include the Windows.h header file.

SetSystemTime Function

SYSTEMTIME st;
st.wYear = 2010;
st.wMonth = 5;
st.wDay = 2;
st.wHour = 7;
st.wMinute = 46;
st.wSecond = 31;
st.wMilliseconds = 345;
::SetSystemTime(&st);


#include Windows.h

BOOL WINAPI SetSystemTime(const SYSTEMTIME *lpSystemTime);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜