Re:How to set System Date and Time
Quote
{*word*104}Ned <lei...@trysoftx.comx> wrote:
: How can I set the system date and time in Delphi 2? In the help I
: could only find the following, under SetSystemTime:
: BOOL SetSystemTime(
: CONST SYSTEMTIME * lpst // address of system time to set );
: It's in C, so it must be available in Delphi. Anyone know where to
: look?
It's the C version of a Windows 32 API call, a full pascal source for
setting time looks like the following:
var
systime : TSystemTime;
begin
systime.wday := d;
systime.wmonth := m;
systime.wyear := y;
systime.whour := h;
systime.wminute := n;
systime.wsecond := s;
systime.wmilliseconds := ms;
SetLocalTime(systime);
end;
The values for d,m,y etc. can be easily got from the DecodeDate and
DecodeTime functions out of the standard Delphi TDateTime.
Bye,
Andy
--
----------------------------------------------------------------------------
Andreas H"orstemeier | ..Our continuing mission:
email: a...@scp.de | to seek out knowledge of C,
a...@farpoint.westend.de | to explore strange unix
www: http://www.westend.de/~hoerstemeier | commands, and to boldly code
fido: 2:2452/108 | where no one has man page 4.
----------------------------------------------------------------------------