Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SetFileAttributes

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function sets the attributes of a file. A RAPI version of this function exists called CeSetFileAttributes (RAPI).


BOOL SetFileAttributes(
  LPCTSTR lpFileName, 
  DWORD dwFileAttributes
); 

lpFileName

[in] Pointer to a string that specifies the name of the file whose attributes are to be set.

The default string size limit for paths is MAX_PATH characters. This limit is related to how this function parses paths.

dwFileAttributes

[in] File attributes to set for the file. This parameter can be a combination of values. However, all other values override FILE_ATTRIBUTE_NORMAL. The following table shows possible values.

Value Description

FILE_ATTRIBUTE_ARCHIVE

Indicates that the file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.

FILE_ATTRIBUTE_HIDDEN

Indicates that the file is hidden. Hidden files and directories are not included in a typical directory listing.

FILE_ATTRIBUTE_NORMAL

Indicates that the file has no other attributes set. This attribute is valid only if used alone.

FILE_ATTRIBUTE_READONLY

Indicates that the file is read-only. Applications can read the file, but cannot write to it or delete it. In the case of a directory, applications cannot delete it.

FILE_ATTRIBUTE_SYSTEM

Indicates that the file or directory is part of, or is used exclusively by, the OS.

FILE_ATTRIBUTE_TEMPORARY

Indicates that the file is being used for temporary storage. File systems attempt to keep all data in memory for quicker access, rather than flushing the data back to mass storage. A temporary file should be deleted as soon as it is no longer needed.

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

This function does not work on the ROM file system. Inherently, this call is dependent on the file system support provided by a file system driver.

The FILE_ATTRIBUTE_DIRECTORY attribute cannot be set using this function. The CreateFile function and this function cannot be used to create directories. To create a directory, use the CreateDirectory function.

Not all file systems support all attributes.

Headerwinbase.h
Librarycoredll.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2014 Microsoft