Registriert seit: 26. Dez 2004
351 Beiträge
Delphi 7 Personal
|
Re: Erstellungsdatum einer Datei ermitteln?
2. Mai 2005, 18:23
Delphi-Quellcode:
function GetCreationTimeOfFile(const AFileName: String;): TDateTime;
var
SR: TSearchRec;
SystemTime: TSystemTime;
NewCreationTime: TFileTime;
begin
Result:=0;
if FindFirst(AFileName, faAnyFile, SR)=0 then
try
IF (Windows.FileTimeToLocalFiletime(SR.FindData.ftCreationTime, NewCreationTime) and
Windows.FileTimeToSystemTime(NewCreationTime, SystemTime)) Then
Result:=Encodedate(SystemTime.wYear,
SystemTime.wMonth,
SystemTime.wDay) +
Encodetime(SystemTime.wHour,
SystemTime.wMinute,
SystemTime.wSecond,
SystemTime.wMilliseconds);
finally
SysUtils.FindClose(SR)
end;
end;
Gruß St.Pauli
|
|
Zitat
|