用以下函数
function GetFileLastAccessTime(sFileName:string;uFlag:byte):TDateTime;
var
ffd:TWin32FindData;
dft
Word;
lft:TFileTime;
h:THandle;
begin
h:=FindFirstFile(PChar(sFileName),ffd);
if h<>INVALID_HANDLE_VALUE then
begin
case uFlag of
FILE_CREATE_TIME:FileTimeToLocalFileTime(ffd.ftCreationTime,lft);
FILE_MODIFY_TIME:FileTimeToLocalFileTime(ffd.ftLastWriteTime,lft);
FILE_ACCESS_TIME:FileTimeToLocalFileTime(ffd.ftLastAccessTime,lft);
else
FileTimeToLocalFileTime(ffd.ftLastAccessTime,lft);
end;
FileTimeToDosDateTime(lft,LongRec(dft).Hi,LongRec(dft).Lo);
Result:=FileDateToDateTime(dft);
windows.FindClose(h);
end
else
result:=0;
end;