Einzelnen Beitrag anzeigen

Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: Änderungsdatum = Erstellerdatum

  Alt 19. Sep 2003, 07:05
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
function GetFileTime(hFile: THandle; lpCreationTime, lpLastAccessTime, lpLastWriteTime: PFileTime): BOOL; stdcall;
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat