I was under the impression that if an application has an open handle and it crashes, the handle isn't released and if you try to access that handle (let's say of a file) then you would get an error.
However, I have tried this in Windows XP onwards and the handle seems to get released if I close the exe from task manager, before it has closed the handle. Following is the code:
Private Sub Form_Load()
Dim iFile As Integer
iFile = FreeFile
Open "myfilelock" For Output Lock Read Write As #iFile
MsgBox "About to close" 'close it here with task manager
Close #iFile
End Sub
So, does Windows XP onwards release all the open handles in case the exe having those handles crashes?