如何获取文件最后一次打开的时间?
文件打开后关闭其属性的访问时间并没有发生变化……那么,应该怎么获得最后一次打开的时间呢?

解决方案 »

  1.   

    文件系统是NTFS格式的吗?要一小时之后才(此处省略一万字)。
      

  2.   

    BOOL GetFileTime(
      HANDLE hFile,                 // handle to file
      LPFILETIME lpCreationTime,    // creation time
      LPFILETIME lpLastAccessTime,  // last access time
      LPFILETIME lpLastWriteTime    // last write time
    );
    On NTFS, access time has a resolution of 1 hour. Therefore, GetFileTime may not return the same file time information set using the SetFileTime function.
      

  3.   

    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; 
      

  4.   

    使用CFindFile的GetLastAccessTime
    难道不行么?这些取得时间似乎都是文件的最后访问时间,但是我打开一个文件再关闭,这个时间并不更新啊(NTFS系统且已经过了1天……)