
22.03.2008, 18:48
|
 |
Активный
|
|
Регистрация: 18.03.2008
Сообщения: 206
Репутация: 16
|
|
Нет, у вас 2 раза объявляется Private и Public. Правильный вариант внизу
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, sButton;
type
TForm1 = class(TForm)
sButton1: TsButton;
procedure sButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure FileCopy(const SourceFileName, TargetFileName: string);
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure FileCopy(const SourceFileName, TargetFileName: string);
var
S, T : TFileStream;
begin
S := TFileStream.Create(sourcefilename, fmOpenRead );
try
T := TFileStream.Create(targetfilename, fmOpenWrite or fmCreate);
try
T.CopyFrom(S, S.Size ) ;
FileSetDate(T.Handle, FileGetDate(S.Handle));
finally
T.Free;
end;
finally
S.Free;
end;
end;
procedure TForm1.sButton1Click(Sender: TObject);
begin
filecopy('c:\folder','d:\folder2');
end;
end.
|