windows_programming_notes.nbk: Home | Index | Next Page: GetFileType | Previous Page: GetFileAttributesEx
Retrieves the date and time that a file or directory was created, last accessed, and last modified.
BOOL WINAPI GetFileTime(
__in HANDLE hFile,
__out_opt LPFILETIME lpCreationTime,
__out_opt LPFILETIME lpLastAccessTime,
__out_opt LPFILETIME lpLastWriteTime
);
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.
Not all file systems can record creation and last access times and not all file systems record them in the same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime function may not return the same file time information set using SetFileTime. NTFS delays updates to the last access time for a file by up to one hour after the last access.
For more information, see File Times.
If you rename or delete a file, then restore it shortly thereafter, Windows searches the cache for file information to restore. Cached information includes its short/long name pair and creation time.
windows_programming_notes.nbk: Home | Index | Next Page: GetFileType | Previous Page: GetFileAttributesEx
Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time