function GetFileLastWriteTime(Path:
string;
var LastWrite : TDateTime): Boolean;
var
hFile: THandle;
rStructur: TWin32FindData;
rFileTime: TFileTime;
dwLastWrite: Cardinal;
begin
Result := False;
hFile :=
Winapi.Windows.FindFirstFile(pchar(Path), rStructur);
if hFile <> INVALID_HANDLE_VALUE
then begin
Winapi.Windows.FindClose(hFile);
{ FILETIME in lokales FILETIME-Format konvertieren }
FileTimeToLocalFileTime(rStructur.ftLastWriteTime, rFileTime);
{ lokales FILETIME-Format ins DOS-Format konvertieren }
FileTimeToDosDateTime(rFileTime, LongRec(dwLastWrite).Hi, LongRec(dwLastWrite).Lo);
{ DOS-Format in ein Delphi-Format konvertieren }
LastWrite := FileDateToDateTime(dwLastWrite);
Result := True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
DT: TDateTime;
begin
if GetFileLastWriteTime(ParamStr(0), DT)
then Label1.Caption := DateTimeToStr(DT);
end;