GetFileInformationByHandle
The GetFileInformationByHandle function retrieves file information for a specified file. BOOL GetFileInformationByHandle(
HANDLE hFile, // handle to file
LPBY_HANDLE_FILE_INFORMATION lpFileInformation // buffer
);
Parameters
hFile
[in] Handle to the file for which to obtain information.
This handle should not be a pipe handle. The GetFileInformationByHandle function does not work with pipe handles. lpFileInformation
[out] Pointer to a BY_HANDLE_FILE_INFORMATION structure that receives the file information. The structure can be used in subsequent calls to GetFileInformationByHandle to refer to the information about the file.
Return Values
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. Res
Depending on the underlying network components of the operating system and the type of server connected to, the GetFileInformationByHandle function may fail, return partial information, or full information for the given file. In general, you should not use GetFileInformationByHandle unless your application is intended to be run on a limited set of operating system configurations.Requirements
Windows NT/2000 or later: Requires Windows NT 3.1 or later.
-----------------------------------------------------------------
SetFileAttributes
The SetFileAttributes function sets a file's attributes. BOOL SetFileAttributes(
LPCTSTR lpFileName, // file name
DWORD dwFileAttributes // attributes
);
Parameters
lpFileName
[in] Pointer to a string that specifies the name of the file whose attributes are to be set.
Windows NT/2000 or later: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions. Windows 95/98/Me: This string must not exceed MAX_PATH characters. dwFileAttributes
[in] Specifies the 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. ---------------------------------------------------------------
(摘自MSDN)
The GetFileInformationByHandle function retrieves file information for a specified file. BOOL GetFileInformationByHandle(
HANDLE hFile, // handle to file
LPBY_HANDLE_FILE_INFORMATION lpFileInformation // buffer
);
Parameters
hFile
[in] Handle to the file for which to obtain information.
This handle should not be a pipe handle. The GetFileInformationByHandle function does not work with pipe handles. lpFileInformation
[out] Pointer to a BY_HANDLE_FILE_INFORMATION structure that receives the file information. The structure can be used in subsequent calls to GetFileInformationByHandle to refer to the information about the file.
Return Values
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. Res
Depending on the underlying network components of the operating system and the type of server connected to, the GetFileInformationByHandle function may fail, return partial information, or full information for the given file. In general, you should not use GetFileInformationByHandle unless your application is intended to be run on a limited set of operating system configurations.Requirements
Windows NT/2000 or later: Requires Windows NT 3.1 or later.
-----------------------------------------------------------------
SetFileAttributes
The SetFileAttributes function sets a file's attributes. BOOL SetFileAttributes(
LPCTSTR lpFileName, // file name
DWORD dwFileAttributes // attributes
);
Parameters
lpFileName
[in] Pointer to a string that specifies the name of the file whose attributes are to be set.
Windows NT/2000 or later: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions. Windows 95/98/Me: This string must not exceed MAX_PATH characters. dwFileAttributes
[in] Specifies the 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. ---------------------------------------------------------------
(摘自MSDN)
具体如下:
当在Windows的Explore中鼠标左键单击文件或者文件夹后,会在Windows的Explore的预览框中显示文件属性信息,例如当鼠标指向一个word文档时在窗口的预览框中会显示文件名、文件类型、文件大小、修改日前等信息。
现在我想添加一些其他的属性信息到文件中去,并且要这些信息也能同文件本来就有的属性信息一样能够在预览框中显示出。
2、修改属性:function FileSetAttr(const FileName: string; Attr: Integer): Integer;
???3、修改时间:function FileSetDate(Handle: Integer; Age: Integer): Integer; 这里的Handle,和Age是什么意思啊
我该如何调用,有实例吗?、
4、该如何使用那两个预留的属性呢
DWORD dwReserved0;
DWORD dwReserved1;
*******************************************
typedef struct _WIN32_FIND_DATA { // wfd
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA;
我该如何去修改这里面的信息呢,