开发者

Change local time by C++ program

开发者 https://www.devze.com 2023-01-12 03:07 出处:网络
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?

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

精彩评论

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