本文整理自网络,侵删。
//判断文件是否正在被使用
function FileINUse(filename:String):boolean;var usein:file;begin result:=false; assignfile(usein,FileName); try reset(Usein); except on E:EInOutError do begin if e.ErrorCode=32 then begin result:=true; exit; end; end; end; closefile(usein);end;
procedure TForm1.Button1Click(Sender: TObject); if OpenDialog1.Execute then begin if fileInuse(OpenDialog1.filename) then ShowMessage('文件正在使用中') else ShowMessage('没有使用'); end; 相关阅读 >>
Delphi d10.x 安卓app开发中按返回键后程序不退出程序的方法
Delphi xe7开发的直接以管理员模式启动cmd命令行界面
Delphi版pspterminateprocess驱动源码
Delphi 正则表达式tperlregex 类的属性与方法
Delphi 使用windows api(wincrypt)计算文件md5哈希,支持大文件
更多相关阅读请进入《Delphi》频道 >>