终止 IdFtp下载
程序员文章站
2022-06-09 16:49:36
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;
上一篇: 酒后饮茶 小心伤肾