Zitat von
Alter Mann:
Für Tipps, Hinweise und Beispiele wie immer dankbar
Hi, auch nachträglich ein Gutes!
Versuch mal dass.
Delphi-Quellcode:
program Project1;
{$APPTYPE CONSOLE}
uses
Windows,
Messages,
SysUtils,
Registry;
var
RegDate: TDateTime;
RegKeyInfo: TRegKeyInfo;
TimeZoneInfo: TTimeZoneInformation;
function DateTimeToLocalDateTime(DateTime: TDateTime): TDateTime;
begin
case GetTimeZoneInformation(TimeZoneInfo) of
TIME_ZONE_ID_STANDARD:
Result := DateTime - (TimeZoneInfo.Bias / 60 / 24);
TIME_ZONE_ID_DAYLIGHT:
Result := DateTime - ((TimeZoneInfo.Bias +
TimeZoneInfo.DaylightBias) / 60 / 24);
else
Result := 0;
end;
end;
procedure FileTimeToDateTime(ft: TFileTime; var dt: TDateTime);
var
SystemTime: TSystemTime;
FileTime: TFileTime;
begin
if FileTimeToLocalFileTime(ft, FileTime) then begin
FileTimeToSystemTime(ft, SystemTime);
dt := SystemTimeToDateTime(SystemTime);
end;
end;
begin
with TRegistry.Create do begin
RootKey := HKEY_CURRENT_USER;
OpenKey('HKEY_CURRENT_USER\Software\Microsoft\Windows', False);
GetKeyInfo(RegKeyInfo);
with RegKeyInfo do begin
FileTimeToDateTime(FileTime, RegDate);
RegDate := DateTimeToLocalDateTime(RegDate);
end;
writeln(DateTimeToStr(RegDate));
CloseKey;
end;
readln;
end.
lg. Astat