Einzelnen Beitrag anzeigen

t.roller
(Gast)

n/a Beiträge
 
#6

AW: DateTime of a Directory

  Alt 31. Jul 2016, 15:57
GetDirTime

Delphi-Quellcode:
function GetDirTime(const Dir: string): TDateTime;
var
  H: Integer;
  F: TFileTime;
  S: TSystemTime;
begin
  H := CreateFile(PChar(Dir), $0080, 0, nil, OPEN_EXISTING,
    FILE_FLAG_BACKUP_SEMANTICS, 0);
  if H <> -1 then
  begin
    GetFileTime(H, @F, nil, nil);
    FileTimeToLocalFileTime(F, F);
    FileTimeToSystemTime(F, S);
    Result := SystemTimeToDateTime(S);
    CloseHandle(H);
  end
  else
    Result := -1;
end;
//ShowMessage(DateTimeToStr(GetDirTime('c:\Program Files')));
  Mit Zitat antworten Zitat