home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / intmail2 / ftptrans.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-07-20  |  1.1 KB  |  57 lines

  1. unit ftptrans;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ComCtrls;
  8.  
  9. type
  10.   TTransferForm = class(TForm)
  11.     ProgressBar1: TProgressBar;
  12.     CancelButton: TButton;
  13.     Label1: TLabel;
  14.     procedure CancelButtonClick(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.     procedure ShowProgress(Received, Total : LongInt);
  20.   end;
  21.  
  22. var
  23.   TransferForm: TTransferForm;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. uses
  30.   FtpMain;
  31.  
  32. procedure TTransferForm.ShowProgress(Received, Total : LongInt);
  33. begin
  34.   if Total<>-1 then
  35.   begin
  36.     Label1.Caption:=IntToStr(Received)+' of '+IntToStr(Total)+
  37.       ' bytes transferred...';
  38.     if Total<>0 then
  39.       ProgressBar1.Position:=Round(100*Received/Total)
  40.     else
  41.       ProgressBar1.Position:=0;
  42.   end
  43.   else
  44.   begin
  45.     Label1.Caption:=IntToStr(Received)+' bytes received';
  46.     ProgressBar1.Position:=0;
  47.   end;
  48. end;
  49.  
  50. procedure TTransferForm.CancelButtonClick(Sender: TObject);
  51. begin
  52.   Hide;
  53.   FTPForm.msFTPClient1.CancelDataTransfer;
  54. end;
  55.  
  56. end.
  57.