本文整理自网络,侵删。
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;
相关阅读 >>
Delphi用twebbrowser组件在Delphi中post数据和取得网页源文件
windows关机函数exitwindowsex使用大全(适用windows所有操作平台)
Delphi 如何让 tgpimage 直接从流中加载图片?
更多相关阅读请进入《Delphi》频道 >>