Выяснить дату последнего доступа к файлу
procedure TForm1.Button1Click(Sender: TObject);
var
FileHandle: THandle;
LocalFileTime: TFileTime;
DosFileTime: DWORD;
LastAccessedTime: TDateTime;
FindData: TWin32FindData;
begin
FileHandle := FindFirstFile('c:/Bootfont.bin', FindData);
if FileHandle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
begin
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
FileTimeToDosDateTime(LocalFileTime,
LongRec(DosFileTime).Hi, LongRec(DosFileTime).Lo);
LastAccessedTime := FileDateToDateTime(DosFileTime);
Label1.Caption := DateTimeToStr(LastAccessedTime);
end;
end;
end;
|