How to know locked file process VB6

Viewed 122

Facing one sporadic issue in legacy application developed in VB6. Application produces intermediate file and then tries to delete it once required output is produced. Application does delete files properly but sometimes, I am getting error stating "Path/File access error". I have tried adding delay to delete but this issue is not getting resolved. I wanted to search if there is any possibility to check process name which has acquired lock in VB6. I tried searching but no luck so far. Could anyone please tell me any way I can get process name which has locked file and causing to not delete?

Please note that this issue happens infrequently.

1 Answers

Windows does not keep a global database of who has what file open. This is for speed reasons. Although it does keep a list of other computers with files open on this computer.

For debugging purposes you can enable a global database. Remember to un-enable it.

So to enable

Openfiles /local on

then reboot.

To query

Openfiles /query /v

See

Openfiles /?

Openfiles /local /?

Openfiles /query /?
Related