终止 IdFtp下载

2020-03-29 16:00:40来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

终止 IdFtp下载

Posted on 2020-03-29 21:20  jjw  阅读(...)  评论(...)  编辑  收藏
 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;

 


原文链接:https://www.cnblogs.com/Jiaojiawang/p/12594957.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Delphi中DBGrid 表中双击直接修改数据(02)

下一篇:delphi 调用百度识别