[code lang=”delphi”]procedure TForm1.Button1Click(Sender: TObject);
Var
S1 : String;
FHan : Integer;
I2 : Integer;
S2 : String;
S3 : String;
FStruct : TOFSTRUCT;
FStruct2 : TOFSTRUCT;
TheDate : TDateTime;
TheDate2 : TDateTime;
FHan2 : Integer;
I3 : Integer;
begin
S3 := Directory95ListBox1.Directory;
If S3[Length(S3)] <> ‘\’ Then S3 := S3 + ‘\’;
S1 := FileListBox1.Filename;
// Here is another file to get the date from
S2 := S3 + FileListBox1.Items.Strings[5];
FHan2 := OpenFile(PChar(S2), FStruct2, OF_READWRITE);
I2 := FileGetDate(FHan2);
// ^^^^^^
FHan := OpenFile(PChar(S1), FStruct, OF_READWRITE);
I3 := FileSetDate(FHan, I2);
TheDate := FileDateToDateTime(I2);
TheDate2 := FileDateToDateTime(I2);
_lclose(FHan);
_lclose(FHan2);
Label1.Caption := DateTimeToStr(TheDate);
Label2.Caption := IntToStr(I3);
end;
[/code]
[tags]Delphi, System, Files[/tags]
0 Kommentare zu “SetFileDate”