Javascript code _ javascript skills used to determine whether a file is being used

Source: Internet
Author: User
This article mainly introduces the JS Code used to determine whether a file is being used. For more information, see The Code is as follows:


// Determine whether the file is in use

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 in use ')
Else
ShowMessage ('unused ');
End;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.