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
| Unit Unit1;
{$mode objfpc}{$H+}
Interface
Uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, EditBtn, StdCtrls;
Type
{ TForm1 }
TForm1 = Class(TForm)
btnCopy: TButton;
edtDir: TDirectoryEdit;
edtFile: TFileNameEdit;
Label1: TLabel;
Procedure btnCopyClick(Sender: TObject);
Procedure edtDirChange(Sender: TObject);
private
public
End;
Var
Form1: TForm1;
Implementation
{$R *.lfm}
{ TForm1 }
Procedure TForm1.btnCopyClick(Sender: TObject);
Var
ScrFileName, DstFileName : String;
Begin
ScrFileName := edtFile.FileName;
DstFileName := edtDir.Directory + PathDelim + ExtractFileName(edtFile.Text);
if messagedlg('CONFIRMEZ-VOUS CETTE OPERATION ? SOURCE '+edtFile.Text +' VERS DESTINATION ' + edtDir.Text,mtconfirmation,[mbyes,mbcancel],0)=mryes then
begin
if CopyFile(PChar(ScrFileName),PChar(DstFileName),false) then showmessage ('OPERATION REUSSIE !') else showmessage (SysErrorMessage(GetLastOSError));
End;
end;
End. |
Partager