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);
精彩评论