CodeItBetter Programming Another VB Programming Blog

How to check the given file is read only

Posted on August 16, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
'File/Folder Handling - How to check the given file is read only
Private Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" _
    (ByVal lpFileName As String) As Long
Const READONLY = &H1
 
Private Function CheckIfReadOnly(ByVal FilePathAndName As String) As Boolean
    attr = GetFileAttributes(FilePathAndName)
    If (attr And &H1) = &H1 Then
        CheckIfReadOnly = True
    Else
        CheckIfReadOnly = False
    End If
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.