词条 | SetFileAttributes |
释义 | 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( LPCTSTR lpFileName, DWORD dwFileAttributes ); 参数: 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, call GetLastError. |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。