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.