1 uses 2 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 3 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBa ...
1 uses 2 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 3 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent, 4 IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, 5 Vcl.StdCtrls; 6 7 type 8 TForm2 = class(TForm) 9 Button1: TButton; 10 IdFTP1: TIdFTP; 11 Button2: TButton; 12 procedure Button1Click(Sender: TObject); 13 procedure Button2Click(Sender: TObject); 14 private 15 procedure a(var message: TMessage); message WM_USER+1; 16 public 17 { Public declarations } 18 end; 19 20 var 21 Form2: TForm2; 22 23 implementation 24 25 {$R *.dfm} 26 27 uses 28 IdReplyRFC; 29 30 procedure TForm2.a(var message: TMessage); 31 begin 32 COLOR := clRed; 33 end; 34 35 procedure TForm2.Button1Click(Sender: TObject); 36 begin 37 IdFTP1.Connect; 38 IdFTP1.ChangeDir('/DelphiDir'); 39 40 TThread.CreateAnonymousThread(procedure begin 41 try 42 IdFTP1.Get('/DelphiDir/delphicbuilder10_1.iso', 'd:\jjw_jjw.rar', true); 43 except 44 on E: EIdReplyRFCError do 45 Postmessage(handle, wm_user+1, 0, 0); 46 end; 47 end).Start; 48 end; 49 50 procedure TForm2.Button2Click(Sender: TObject); 51 begin 52 IdFTP1.KillDataChannel; 53 end;