Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
Delphi 7 Enterprise
|
Re: Änderungsdatum = Erstellerdatum
19. Sep 2003, 08: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;
|
|
Zitat
|