SetFileAttributes

王朝百科·作者佚名  2010-03-07  
宽屏版  字体: |||超大  

SetFileAttributes

VB声明

Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long

说明

设置文件属性

返回值

Long,非零表示成功,零表示失败。会设置GetLastError

参数表

参数 类型及说明

lpFileName String,要设置其属性的文件名

dwFileAttributes Long,带有FILE_ATTRIBUTE_??前缀的一个或多个常数

VC

函数原型

BOOL SetFileAttributes(

LPCTSTRlpFileName,

DWORDdwFileAttributes

);

参数:

lpFileName[in] Pointer to a string that specifies the name of the file whose attributes are to be set. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\?" to the path. For more information, see Naming a File.

Windows Me/98/95:This string must not exceed MAX_PATH characters.dwFileAttributes[in] File attributes to set for the file. This parameter can be one or more of the following values. However, all other values override FILE_ATTRIBUTE_NORMAL.

属性:

Attribute

Meaning

FILE_ATTRIBUTE_ARCHIVE

The file is an archive file. Applications use this attribute to mark files for backup or removal.

FILE_ATTRIBUTE_HIDDEN

The file is hidden. It is not included in an ordinary directory listing.

FILE_ATTRIBUTE_NORMAL

The file has no other attributes set. This attribute is valid only if used alone.

FILE_ATTRIBUTE_NOT_CONTENT_INDEXED

The file will not be indexed by the content indexing service.

FILE_ATTRIBUTE_OFFLINE

The data of the file is not immediately available. This attribute indicates that the file data has been physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software. Applications should not arbitrarily change this attribute.

FILE_ATTRIBUTE_READONLY

The file is read-only. Applications can read the file but cannot write to it or delete it.

FILE_ATTRIBUTE_SYSTEM

The file is part of the operating system or is used exclusively by it.

FILE_ATTRIBUTE_TEMPORARY

The file is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because often the application deletes the temporary file shortly after the handle is closed. In that case, the system can entirely avoid writing the data. Otherwise, the data will be written after the handle is closed.

返回值:If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, callGetLastError.

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有