GetFileTime

  BOOL GetFileTime(hFile, lpftCreation, lpftLastAccess, lpftLastWrite)    
  HANDLE hFile; /* identifies the file */
  LPFILETIME lpftCreation; /* time the file was created */
  LPFILETIME lpftLastAccess; /* time the file was last accessed */
  LPFILETIME lpftLastWrite; /* time the file was last written */

The GetFileTime function retrieves the date and time that a file was created, last accessed and last modified.

Parameters

hFile

Specifies an open file handle. The file handle must have been created with GENERIC_READ access to the file.

lpftCreation

Points to a FILETIME structure that receives the date and time the file was created. This parameter can be NULL if the application does not require this information.

The FILETIME structure has the following format:

typedef struct _FILETIME { /* ft */

DWORD dwLowDateTime; /* low 32 bits */

DWORD dwHighDateTime; /* high 32-bits */

} FILETIME, *PFILETIME, *LPFILETIME;

lpftLastAccess

Points to a FILETIME structure that receives the date and time the file was last accessed. This parameter can be NULL if the application does not require this information.

lpftLastWrite

Points to a FILETIME structure that receives the date and time the file was last written to. This parameter can be NULL if the application does not require this information.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

See Also

SetFileTime, GetFileType, GetFileSize