The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified. BOOL GetFileTime( HANDLE hFile, // handle to the file LPFILETIME lpCreationTime, // address of creation time LPFILETIME lpLastAccessTime, // address of last access time LPFILETIME lpLastWriteTime // address of last write time );
Parameters hFile Handle to the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file. lpCreationTime Pointer to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information. lpLastAccessTime Pointer to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information. lpLastWriteTime Pointer to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information. 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 The FAT and NTFS file systems support the file creation, last access, and last write time values. Windows 95: The precision of the time for a file in a FAT file system is 2 seconds. The time precision for files in other file systems, such as those connected through a network depends on the file system but may also be limited by the remote device.QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in winbase.h. Import Library: Use kernel32.lib.See Also Time Overview, Time Functions, FILETIME, GetFileSize, GetFileType, SetFileTime
u see, just compare this parameter---LPFILETIME lpLastWriteTime--of A and B, u can get ur answer ....:)
i see, but my english is so poor that neet 15 minutes to understant your reply maybe.~~~555
warning C4700: local variable 'lpLastWriteTime' used without having been initialized 怎么初始化啊??
this just a warning ...u can omit this ....:)
thank u again,but can you tell me: how to compare two variable by LPFILETIME type?
别的已经搞定了,请问,FILETIME Structure The FILETIME structure has the following form:typedef struct _FILETIME { DWORD dwLowDateTime; /* low 32 bits */ DWORD dwHighDateTime; /* high 32 bits */ } FILETIME, *PFILETIME, *LPFILETIME; dwLowDateTime和dwHighDateTime有什么区别??怎么取得的数值大不一样
CompareFileTime The CompareFileTime function compares two 64-bit file times. LONG CompareFileTime( CONST FILETIME *lpFileTime1, // pointer to first file time CONST FILETIME *lpFileTime2 // pointer to second file time );
HANDLE hFile, // handle to the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);
Parameters
hFile
Handle to the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file.
lpCreationTime
Pointer to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information.
lpLastAccessTime
Pointer to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.
lpLastWriteTime
Pointer to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information.
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
The FAT and NTFS file systems support the file creation, last access, and last write time values. Windows 95: The precision of the time for a file in a FAT file system is 2 seconds. The time precision for files in other file systems, such as those connected through a network depends on the file system but may also be limited by the remote device.QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.See Also
Time Overview, Time Functions, FILETIME, GetFileSize, GetFileType, SetFileTime
怎么初始化啊??
char ctimes[10]={'\0'};
itoa(lpLastWriteTime.dwLowDateTime,ctimes,10);
MessageBox (NULL,ctimes,tmp,0);
The FILETIME structure has the following form:typedef struct _FILETIME {
DWORD dwLowDateTime; /* low 32 bits */
DWORD dwHighDateTime; /* high 32 bits */
} FILETIME, *PFILETIME, *LPFILETIME;
dwLowDateTime和dwHighDateTime有什么区别??怎么取得的数值大不一样
The CompareFileTime function compares two 64-bit file times. LONG CompareFileTime(
CONST FILETIME *lpFileTime1, // pointer to first file time
CONST FILETIME *lpFileTime2 // pointer to second file time
);