Declare Function SetFileAttributes Lib "kernel32.dll" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
SetFileAttributes changes the attributes of a file or a directory. The four attributes you can set are archive, read-only, hidden, and system status -- the other attributes merely reflect unchangeable properties of the file. Any of the four can be on or off in any order. The function returns 0 if an error occured, or 1 if successful.
Example:
' Set the file C:\MyProgram\secret.dat to a hidden, read-only,
' archive file.
Dim fileattrs As Long ' file attributes
Dim retval As Long ' return value
fileattrs = FILE_ATTRIBUTES_ARCHIVE Or FILE_ATTRIBUTES_HIDDEN Or FILE_ATTRIBUTES_READONLY
retval = SetFileAttributes("C:\MyProgram\secret.dat", fileattrs) ' set the file's attributes
See Also: GetFileAttributes
Category: Files
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/setfileattributes.html