Jump to content
Sign in to follow this  

How to gain exclusive use of a file?

Recommended Posts


I need to open a file for exclusive use. IOW, have my script's open operation fail if any other application has the file open for editing or appending. In the help file, I located a statement that I've never used, but that sounded like the answer:

$file = _WinAPI_OpenFileDlg( * * * * * * *, BitOR($OFN_FILEMUSTEXIST, $OFN_SHAREAWARE))

But it never returns a non-zero error to indicate a problem, like when a text file is open in WordPad.

Can someone suggest a proper method? ... or point me to documentation?

Thanks in advance for help.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this