Autor Beitrag
Blackmix
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Sa 06.07.02 15:22 
:?:
Wie kann ich das Datum einer Datei verändern??
("Erstellt", "Verändert", "letzter Zugriff")

merci d'avance
blackmix
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: So 07.07.02 22:11 
Die Jedi-Lib bietet dazu einige Funtionen.
Die Jedi findest du hier:www.faqsen.de/find.j...494850504948485356;2

_________________
Keine Signatur ...
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 07.07.02 22:44 
Hier der direkte Link:

www.delphi-jedi.org/
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: So 07.07.02 23:22 
Da gibts auch die Funktionen und keine Funtionen :wink:

_________________
Keine Signatur ...
Blackmix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Mo 08.07.02 01:08 
Also, ich habe jetzt mal auf den Link von Steffer gekuck, nur da habe ich eine Hilfe gefunden, wie man das "Geändert"-Datum der Datei setzen kann, aber nicht, wie man das "Erstellt"-Datum ändern kann.

Mit Tino's Link konnte ich nichts anfangen, denn das war alles nur für "Members" und ich wollte jetzt nicht einer werden.

Aber ich habe es trotzem geschaft mein Problem zu lösen! Mit der API Funktion "SetFileTime" konnte ich mein Problem lösen.

Trotzem danke für eure Tipps (& und die für mich neuen Delphi-Seiten)

Blackmix
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Mo 08.07.02 09:14 


Zuletzt bearbeitet von Pit am Sa 05.10.02 06:52, insgesamt 1-mal bearbeitet
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 08.07.02 09:19 
@Balckmix: Also wenn ich den Link von Steffer folge bekomme ich nur einen weitern Link mit dem Hinweis "Enthält hunderte von nützlichen Routinen und ist kostenfrei" zu sehen? Wenn man den Link anwählt kommt man auf die gleiche Site die ich genannt habe.
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Mo 08.07.02 11:25 
hehe :D
ja, die sind absolut identisch ....

_________________
Keine Signatur ...
Blackmix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 09.07.02 00:19 
@Pit, hey Deine Unit sieht ja super kompliziert aus! (vielleicht sehe ich auch einfach nur nicht ganz durch...) Also, ich muss Dir mal meine Prozedur geben.

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
type 
  TArrayDateTime = array[0..2] of TDateTime;

const 
  ArrayDateTime : TArrayDateTime = 
                               ( 36000,   {Erstellt}
                                 36000,   {Letzter Zugriff}
                                 36000 ); {Geändert am}

function SetFileDateTime(FileName: string; NewDateTime: TArrayDateTime): Boolean;
var
  FileHandle: Integer;
  FileTime: TFileTime;
  LFT: TFileTime;
  LST: TSystemTime;
  i: integer;
begin
  Result := False;
  FileHandle:=-1;
  for i:=0 to 2 do
   Begin;
        try
          DecodeDate(NewDateTime[i], LST.wYear, LST.wMonth, LST.wDay);
          DecodeTime(NewDateTime[i], LST.wHour, LST.wMinute,  LST.wSecond, LST.wMilliSeconds);
          if SystemTimeToFileTime(LST, LFT) then
          begin
            if LocalFileTimeToFileTime(LFT, FileTime) then
            begin
              FileHandle := FileOpen(FileName, fmOpenReadWrite or
                fmShareExclusive);
              case i of
                0: if SetFileTime(FileHandle, @FileTime, nil, nil ) then
                      Result := Result and True;
                1: if SetFileTime(FileHandle, nil, @FileTime, nil ) then
                      Result := Result and True;
                2: if SetFileTime(FileHandle, nil, nil, @FileTime ) then
                      Result := Result and True;
              end;
            end;
          end;
        finally
          FileClose(FileHandle);
        end;
   End;
end;


prcocedure run;
Begin;
  if SetFileDateTime('C:\config.sys',ArrayDateTime) then 
   Label1.Caption:='Dateidatum wurde geändert.'
End;


Hat jemand noch Verbesserungsvorschläge?
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Di 09.07.02 02:44 


Zuletzt bearbeitet von Pit am Sa 05.10.02 06:53, insgesamt 1-mal bearbeitet
Blackmix Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 09.07.02 15:25 
@Pit: Hm, wenn ich mir eine Unit so ansehe, sieht die wirklich besser aus. Danke! Ich weiß nicht ob ich heute noch dazu komme sie in mein Programm einzubauen, aber ich werde es auf alle Fälle testen.

Es ist nämlich so, dass ich morgen nach Frankreich fahre. (=Urlaub)
cu
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Di 09.07.02 17:51