Now in my country the local time is:
3:43 PM
Can I write program in C++ to change the time on a Windows 7 system to another time?
For example set it to 5:00 PM (increase) or decrease it?
Now in my country the local time is:
3:43 PM
Can I write program in C++ to change the time on a Windows 7 system to another time?
For example set it to 5:00 PM (increase) or decrease it?
The answer to this question depends on your operating system.
However doing this in C++ seems pointless. If you really want to this programmatically It may be easier to write a shell/batch script.
#include Windows.h
BOOL WINAPI SetSystemTime(const SYSTEMTIME *lpSystemTime);
In VC++ you can try. Include the Windows.h header file.
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);