Public Function IsFileReady(ByVal filepath As String) As Boolean '检查文件是否正在被使用的函数
If File.Exists(filepath) = False Then
Return True
Exit Function '如果filpath文件不存在,也就不没有被占用,应该返回true
End If
Try
File.Open(filepath, FileMode.Open).Close()
Return True
Catch e As Exception
'MsgBox("Writing was disallowed, as expected: " & e.ToString())
Return False
End Try
End Function