Identification if the JPG file is open
I am trying to set up an error trap that will detect that the file is already open. This is not a problem when the file is a text file using the following code:
Private Function FILEOPEN (ByVal sFile As String) As Boolean
Dim THISFILEOPEN As Boolean = False
Try
Using f As New IO.FileStream(sFile, IO.FileMode.Open)
THISFILEOPEN = False
End Using
Catch
THISFILEOPEN = True
End Try
Return THISFILEOPEN
End Function
My problem is when the file is an open JPG file and not a text file, does the above function return False indicating that it is not open? I've tried various options for the function, but still can't find a function that can detect if a JPG file is open.
+3
source to share