2009. október 28., szerda
Set system date and time
Problem/Question/Abstract:
Set system date and time
Answer:
With the procedure SetDateTime you can set the date and time of the operating system, from within your Delphi application.
In the interface-section you define the procedure:
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
In the 'implementation' you write...:
{ SetDateTime sets the date and time of the operating system }
procedure SetDateTime(Year, Month, Day, Hour, Minu, Sec, MSec: Word);
var
NewDateTime: TSystemTime;
begin
FillChar(NewDateTime, sizeof(NewDateTime), #0);
NewDateTime.wYear := Year;
NewDateTime.wMonth := Month;
NewDateTime.wDay := Day;
NewDateTime.wHour := Hour;
NewDateTime.wMinute := Minu;
NewDateTime.wSecond := Sec;
NewDateTime.wMilliseconds := MSec;
SetLocalTime(NewDateTime);
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése