关于获取文件最后一次打开的时间
如何获取文件最后一次打开的时间?
文件打开后关闭其属性的访问时间并没有发生变化……那么,应该怎么获得最后一次打开的时间呢?
[解决办法]
文件系统是NTFS格式的吗?要一小时之后才(此处省略一万字)。
[解决办法]
BOOL GetFileTime( HANDLE hFile, // handle to file LPFILETIME lpCreationTime, // creation time LPFILETIME lpLastAccessTime, // last access time LPFILETIME lpLastWriteTime // last write time);
[解决办法]
BOOL GetFileAttributesEx(
LPCTSTR lpFileName, // file or directory name
GET_FILEEX_INFO_LEVELS fInfoLevelId, // attribute class
LPVOID lpFileInformation // attribute information );
----------------------
WIN32_FILE_ATTRIBUTE_DATA
The WIN32_FILE_ATTRIBUTE_DATA structure contains attribute information for a file or directory. The GetFileAttributesEx function uses this structure.
typedef struct _WIN32_FILE_ATTRIBUTE_DATA{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;