Windows API Guide: RegisterClass Function


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.

lpFileName
The filename or directory, including the full path, to change the attributes of.
dwFileAttributes
One or more of the following flags specifying the attributes to set (those that can only be set by the operating system are not listed here):
FILE_ATTRIBUTE_ARCHIVE = &H20
An archive file (which most files are).
FILE_ATTRIBUTE_HIDDEN = &H2
A hidden file, not normally visible to the user.
FILE_ATTRIBUTE_NORMAL = &H80
An attribute-less file (cannot be combined with other attributes).
FILE_ATTRIBUTE_READONLY = &H1
A read-only file.
FILE_ATTRIBUTE_SYSTEM = &H4
A system file, used exclusively by the operating system.

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



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net