My app is downloading files with Winsock and writing them to disk. I'm using CreateFile/WriteFile API to write the files, because I like it better than Open/Put.
Actually the file writing is done with a Usercontrol array, so after thinking about it, I don't need to store the file handles in an array. The only thing I have to do is add a sub to the Usercontrol to close the handle and then loop through the usercontrol array and calling the sub the in the Form_Unload event.
Code:
Public Sub StopWriting()
CloseHandle File_Number
End Sub
Code:
Private Sub Form_Unload(Cancel As Integer)
Dim i As Long
For i = 0 To FileWrite.UBound
FileWrite(i).StopWriting
Next
End Sub