Recent

Author Topic: TFileTime not run in MAc OS  (Read 2011 times)

laguna

  • Sr. Member
  • ****
  • Posts: 323
TFileTime not run in MAc OS
« on: September 14, 2023, 06:37:59 am »
This function change date time on file.
Run in Windows but not run in Mac OS
This is message: syncthread.pas(213,15) Error: Identifier not found "TFileTime"

help me thanks


Code: Pascal  [Select][+][-]
  1.   procedure myFileSetDateTime(const FileName: string; DateTime: TDateTime);
  2.   var
  3.     FileHandle: THandle;
  4.     FileTime: TFileTime;
  5.     SystemTime: TSystemTime;
  6.   begin
  7.     FileHandle := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
  8.     if FileHandle <> THandle(-1) then
  9.     begin
  10.       try
  11.         DateTimeToSystemTime(DateTime, SystemTime);
  12.         SystemTimeToFileTime(SystemTime, FileTime);
  13.         SetFileTime(FileHandle, @FileTime, @FileTime, @FileTime);
  14.       finally
  15.         FileClose(FileHandle);
  16.       end;
  17.     end
  18.     else
  19.     begin
  20.       // Gestisci l'errore se non è possibile aprire il file
  21.       raise Exception.Create('Impossibile aprire il file: ' + FileName);
  22.     end;
  23.   end;  
« Last Edit: September 14, 2023, 12:35:40 pm by laguna »

 

TinyPortal © 2005-2018