Object in Use

Find quick help here to get you started with Hollywood
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Object in Use

Post by djrikki »

Hi guys,

Is there a command or routine I can use to detect whether a file is already in use/being written to?
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Object in Use

Post by airsoftsoftwair »

No. A dirty trick would be to make a backup of the file in Ram:, then try to delete it using DeleteFile(). Then check with GetLastError() if deleting succeeded... if it did, then the file is not in use and you have to restore it using the backup made earlier. If it couldn't be deleted, then it is in use. But that is really a dirty technique... not recommended.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Object in Use

Post by Bugala »

If you are checking only files that you are accessing with that same problem, you could also keep list of open file names and compare to be accessed file to them.
Post Reply