function GetFileLastAccessTime(FileName: string; AFlag: Integer): TDateTime;
var
WFD: TWin32FindData;
FileTime: TFileTime;
hFile: THandle;
DFT: DWORD;
begin
hFile := FindFirstFile(Pchar(FileName), WFD);
if hFile <> INVALID_HANDLE_VALUE then
begin
// FindClose(hFile);
case AFlag of
1:
FileTimeToLocalFileTime(WFD.ftCreationTime, FileTime);
2:
FileTimeToLocalFileTime(WFD.ftLastAccessTime, FileTime);
3:
FileTimeToLocalFileTime(WFD.ftLastWriteTime, FileTime);
end;
FileTimeToDosDateTime(FileTime, LongRec(DFT).HI, LongRec(DFT).LO);
Result := FileDateToDateTime(DFT);
end;
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.096023082733154 seconds