by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Set File atrributes using SetFileAttributes API
API Declarations
Const HIDDEN = &H2
Const SYSTEM = &H4
Const ARCHIVE = &H20
Const NORMAL = &H80
Private Declare Function SetFileAttributes Lib "kernel32.dll" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
Dim attr As Long
Dim rval As Long
attr = READONLY + SYSTEM + HIDDEN
rval = SetFileAttributes("C:\karthik\waste.txt", attr)
End
End Sub