Einzelnen Beitrag anzeigen

tcoman
(Gast)

n/a Beiträge
 
#8

AW: DateTime of a Directory

  Alt 1. Aug 2016, 17:41
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')));
Wow! Really amazing code. Lots of thanks,
Terence
  Mit Zitat antworten Zitat