Hidden, Normal, etc. To use this API, paste the following code into the
declaration section:
Public Declare Function SetFileAttributes Lib "kernel32" Alias
"SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As
Long) As Long
Then to set the file attributes, type:
Variable = SetFileAttributes ("File Location", Value)
The FileLocation is the location of the file for which you want to set the file
attributes. The Value is the value given of the attribute you want to set. Here
is a table of Values:
Value Attribute
0 Normal (No Attributes)
1 Read Only
2 Hidden
3 Read Only & Hidden
You can try placing other numbers to set other attributes. So, for example, to
make a file hidden and read only that is located at C:\Work\Work.txt, type:
Variable = SetFileAttributes ("C:\Work\Work.txt", 3)
This was first published in November 2000