Hi how can i check to see if a text file is being used by another application in VB6 ??
Printable View
Hi how can i check to see if a text file is being used by another application in VB6 ??
May be this might help:
There are a couple of tricks you can use.
Try FileExist. In many cases FileExist will return a 2 if the file exists but is open in read-deny mode.
VB Code:
a=FileExist("yourfile") a==0 then no file. a==1 file exists. Looks OK. a==2 file exists. Not currently accessible.
Try FileSize. If a file is open or being written to, FileSize will return a 0. File in use:
Filesize==0
Put the two of them together with:
VB Code:
While !FileExist("filename") TimeDelay(1) endwhile While FileSize("filename")==0 TimeDelay(1) endwhile