G
Guest
I want to know if a file is currently locked aby nother prcess... but in the
most efficent way possible.. i mean is there some API calls that i can use? i
would want to avoid having to catch (and cause) exceptions since they are
really slooooooow..
i know the following works:
Private Function IsOpen(ByVal sFilePath As String) As Boolean
Dim boOut As Boolean
Try
Dim oFileStream As New IO.FileStream(sFilePath,
IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None)
oFileStream.Close()
boOut = False
Catch
boOut = True
End Try
Return boOut
End Function
But is there a better way (withotu Exceptions)? i would like something like
IO.File.IsLocked("filePath") ... (if that existed)..
How does windows determine if a file is opened/locked/in use? Is there a way
to make the same check through api?
Thanks for any help!!!
most efficent way possible.. i mean is there some API calls that i can use? i
would want to avoid having to catch (and cause) exceptions since they are
really slooooooow..
i know the following works:
Private Function IsOpen(ByVal sFilePath As String) As Boolean
Dim boOut As Boolean
Try
Dim oFileStream As New IO.FileStream(sFilePath,
IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None)
oFileStream.Close()
boOut = False
Catch
boOut = True
End Try
Return boOut
End Function
But is there a better way (withotu Exceptions)? i would like something like
IO.File.IsLocked("filePath") ... (if that existed)..
How does windows determine if a file is opened/locked/in use? Is there a way
to make the same check through api?
Thanks for any help!!!