Delphi 上次访问该文件的时间

2022-12-12 16:25:28 作者:admin

本文整理自网络,侵删。

 function GetFileLastAccessTime(sFileName: string): TDateTime;var  ffd : TWin32FindData;  dft : DWord;  lft : TFileTime;  h   : THandle;begin  // get file information  h := Winapi.Windows.FindFirstFile(PChar(sFileName), ffd);  if INVALID_HANDLE_VALUE <> h then  begin    Winapi.Windows.FindClose(h);
    // convert the FILETIME to local FILETIME    FileTimeToLocalFileTime(ffd.ftLastAccessTime, lft);
    FileTimeToDosDateTime(lft, LongRec(dft).Hi, LongRec(dft).Lo);
    Result := FileDateToDateTime(dft);  end;end;
procedure TForm1.FormCreate(Sender: TObject);beginMessageDlg(    'c:\config.sys was last accessed on '    + DateTimeToStr(GetFileLastAccessTime('c:\vcredist_x86.log')),    mtInformation, [mbOk], 0);end;

相关阅读 >>

Delphi adoconnection1连接mssql数据库方法

Delphi mscomm 发送接收

Delphi控件安装与删除

Delphi调用阿里云的对象存储服务oss

Delphi配置文件ini

常用的几个网络函数和系统函数

Delphi xe 新功能试用:多种皮肤样式静、动态设置方法

Delphi tfontdialog

Delphi xe7 取得进程占用内存的两个函数

Delphixe5如何获取android手机sim卡串号

更多相关阅读请进入《Delphi》频道 >>



在线咨询 拨打电话