TDateTime __fastcall GetDirLastTime(String DirName)
{
TDateTime nowtime ;
SYSTEMTIME stime;
HANDLE hDir = CreateFile (DirName.c_str(), GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_DELETE,NULL, OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL);
FILETIME lpCreationTime;
FILETIME lpLastAccessTime;
FILETIME lpLastWriteTime;
if (GetFileTime(hDir,&lpCreationTime,&lpLastAccessTime,&lpLastWriteTime))
{
FILETIME ftime;
FileTimeToSystemTime(&lpLastWriteTime,&stime);
nowtime=SystemTimeToDateTime(stime);
}
CloseHandle(hDir);
return nowtime;
}
获取文件的修改时间
最新推荐文章于 2022-07-05 20:36:49 发布