Hi guys,
Is there a command or routine I can use to detect whether a file is already in use/being written to?
Object in Use
Object in Use
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
http://myevolve.wordpress.com
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Object in Use
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.
Re: Object in Use
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.