Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Änderungsdatum = Erstellerdatum (https://www.delphipraxis.net/9080-aenderungsdatum-%3D-erstellerdatum.html)

bixi400 17. Sep 2003 18:50


Änderungsdatum = Erstellerdatum
 
Hi!
Wie kann ich bei einer Datei
das Änderungsdatum durch das Ersteller datum Ändern?

Oder geht das überhaupt nich?

Wenn ja wie? (Delphi-Code)

Danke schon im voraus!

APP 19. Sep 2003 07:05

Re: Änderungsdatum = Erstellerdatum
 
Hallo,

Um alle 3 File-Datums zu ändern:

Delphi-Quellcode:
VAR
  SysT                            : TSystemTime;
  FileT                           : TFileTime;
  aHandle                         : THandle;
BEGIN
  SysT.wDay := 1;
  SysT.wYear := 2001;
  SysT.wMonth := 3;
  SysT.wHour := 4;
  SysT.wMinute := 5;
  SysT.wSecond := 6;
  SystemTimeToFileTime(SysT, FileT);
  aHandle := CreateFile(PChar('C:\test.txt'), GENERIC_WRITE, 0,
    NIL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0);
  //PSDK:
  //BOOL SetFileTime(
  //  HANDLE hFile,
  //  const FILETIME* lpCreationTime,
  //  const FILETIME* lpLastAccessTime,
  //  const FILETIME* lpLastWriteTime
  //);
  SetFileTime(aHandle, @FileT, @FileT, @FileT);
  CloseHandle(aHandle);
Zum Auslesen des gewünschten Datums benutze
Delphi-Quellcode:
function GetFileTime(hFile: THandle; lpCreationTime, lpLastAccessTime, lpLastWriteTime: PFileTime): BOOL; stdcall;


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:43 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz