Home > Web Front-end > JS Tutorial > JS code to determine whether a file is being used_javascript skills

JS code to determine whether a file is being used_javascript skills

WBOY
Release: 2016-05-16 17:07:56
Original
1146 people have browsed it

Copy code The code is as follows:

//Determine whether the file is being used

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('File is in use')
else
ShowMessage('not used');
end;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template