Hallo,
in den Einträgen der FileListBox sind die Informationen nicht enthalten,
aber damit kommst Du weiter:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51:
| procedure FileTimeInfo(aFile: String;aMemo: TMemo); var sr:TSearchRec; LTime : TFileTime; Systemtime : TSystemtime; Dt:TDateTime; sAttr, sTime, sC, sL_W, sL_A : String; function FileAttribute(attr: integer): string; begin if attr < 0 then exit; result := ''; if attr and 1 = 1 then result := result + 'R'; if attr and 2 = 2 then result := result + 'H'; if attr and 4 = 4 then result := result + 'S'; if attr and 32 = 32 then result := result + 'A'; if attr and 64 = 64 then result := result + ''; if attr and 128 = 128 then result := result + ''; end; begin if FindFirst(aFile, faAnyFile, sr) = 0 then begin sAttr := FileAttribute(sr.Attr); dt := FileDateToDateTime(sr.Time); sTime := DateTimeToStr(dt); FileTimeToLocalFileTime( sr.FindData.ftCreationTime, LTime); FileTimeToSystemTime( LTime, SystemTime ); sC := FormatDateTime('dd/mm/yyyy hh:nn:ss' ,SystemTimeToDateTime( SystemTime)); FileTimeToLocalFileTime( sr.FindData.ftLastWriteTime, LTime); FileTimeToSystemTime( LTime, SystemTime ); sL_W := FormatDateTime('dd/mm/yyyy hh:nn:ss' ,SystemTimeToDateTime( SystemTime)); FileTimeToLocalFileTime( sr.FindData.ftLastAccessTime, LTime); FileTimeToSystemTime( LTime, SystemTime ); sL_A := FormatDateTime('dd/mm/yyyy hh:nn:ss' ,SystemTimeToDateTime( SystemTime)); with aMemo.Lines do begin Add('sr.Attr: '+sAttr); Add('sr.Time: '+sTime); Add('sr.FindData.ftCreationTime: '+sC); Add('sr.FindData.ftLastWriteTime: '+sL_W); Add('sr.FindData.ftLastAccessTime: '+sL_A); end; end; FindClose(sr); end; |
und der Aufruf:
Delphi-Quelltext
1: 2: 3: 4:
| procedure TForm1.Button1Click(Sender: TObject); begin FileTimeInfo(FileListBox1.FileName,Memo1); end; |
Zwischen der Zeit von sr.Time und SR.FindData.ftLastAccessTime gibt es eine Abweichung von ca. 1 bis 3 Sekunden.
Der Explorer zeigt die Zeit von ftLastAccessTime an.