Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Systemzeit setzen (NT,W2000,XP) (https://www.delphipraxis.net/9094-systemzeit-setzen-nt-w2000-xp.html)

Sharky 18. Sep 2003 06:36


Systemzeit setzen (NT,W2000,XP)
 
Hai :hi:

gibt es eine möglichkeit aus meinem Delphiprogramm heraus die Systemzeit von Windows zu setzen?

Luckie 18. Sep 2003 06:44

Re: Systemzeit setzen (NT,W2000,XP)
 
SetSystemTime.

Sharky 18. Sep 2003 07:48

Re: Systemzeit setzen (NT,W2000,XP)
 
Zitat:

Zitat von Luckie
SetSystemTime.

:wall:

Habe immer nur nach SetTime gesucht

Danke dir! :mrgreen:

Sharky 18. Sep 2003 08:13

Re: Systemzeit setzen (NT,W2000,XP)
 
Hai,

nur zur kontrolle. Habe ich das so richtig verstanden mit den TimeZone-Informationen?

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
 systemzeit : TSystemTime;
 zeitzone : TTimeZoneInformation;
 localdiff : Integer;
begin
 Case GetTimeZoneInformation (zeitzone) of
  TIME_ZONE_ID_STANDARD : localdiff := (zeitzone.Bias div 60);
  TIME_ZONE_ID_DAYLIGHT : localdiff := (zeitzone.Bias div 60) + (zeitzone.DaylightBias div 60);
 end;
 with systemzeit do
  begin
   wYear := 2003;
   wMonth := 9;
   wDay := 18;
   wHour := StrToInt (Edit1.Text) + localdiff;
   wMinute := StrToInt (Edit2.Text);
   wSecond := StrToInt (Edit3.Text);
   wMilliseconds := 0;
  end;
 SetSystemTime (systmzeit);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz