谁能告诉我修改机器时间的函数?
解决方案 »
- webbrowser的一个小问题
- 请问大家:有关窗体间的问题。在线等。
- ListView和vb中的Listview增加不同之处!
- 如何将16进制转为2进制?
- 高手请进!
- 关于ClientDataSet的Filter中文支持问题,再次发贴
- 过年送大礼!大散分!!
- 怎样通过lable等控件来拖动无标题条的窗口?
- select max(con1,con2) as con3 from table 对不对?
- 新人第一次发帖,请教下网络传输问题
- 求助:paradox表中要查某字段中记录为空(也就是什么都没有)的记录,如何实现?
- 我在toolbar上放了一个label,但是label的位置总是偏上,怎样让label向下移一点?
BOOL SetSystemTime(
const SYSTEMTIME* lpSystemTime
);Parameters
lpSystemTime
[in] Pointer to a SYSTEMTIME structure that contains the current system date and time.
The wDayOfWeek member of the SYSTEMTIME structure is ignored.Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError.Res
The SetSystemTime function enables the SE_SYSTEMTIME_NAME privilege before changing the system time. This privilege is disabled by default. For more information, see Running with Special Privileges.Example Code
For an example, see Setting the System Time.Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
Members
wYear
Current year. The year must be greater than 1601. Windows Server 2003, Windows XP: The year cannot be greater than 30827.
wMonth
Current month; January = 1, February = 2, and so on.
wDayOfWeek
Current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Current day of the month.
wHour
Current hour.
wMinute
Current minute.
wSecond
Current second.
wMilliseconds
Current millisecond.
Res
It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should
var
S: SYSTEMTIME;
begin
DateTimeToSystemTime(Now,S);
SetLocalTime(S);
end;
S: SYSTEMTIME;
begin
DateTimeToSystemTime(strtodatetime('2003-4-29 15:14:32'),S);
SetLocalTime(S);
end;
var
S: SYSTEMTIME;
begin DateTimeToSystemTime(datetimepicker1.DateTime,S);
SetLocalTime(S);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
systemtime:Tsystemtime;
begin
getlocaltime(systemtime);
statusbar1.Panels[0].Text:=formatdatetime('yyyy-mm-dd',systemtimetodatetime(systemtime));
end;end.