1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
Private Declare Function lClose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Function dejaouvert(FileName As String) As Boolean
Dim fic As Long, crac As Long
fic = -1: crac = 0
fic = lOpen(FileName, &H10)
If fic = -1 Then
crac = Err.LastDllError
Else
lClose (fic)
End If
dejaouvert = (fic = -1) And (crac = 32)
End Function
Private Sub Command1_Click()
MsgBox dejaouvert("d:\toto.ext")
End Sub |
Partager