我用TNMFTP控件上传文件,怎么用进度条显示上传进度呀?(100分)

  • 主题发起人 主题发起人 byebyebye
  • 开始时间 开始时间
B

byebyebye

Unregistered / Unconfirmed
GUEST, unregistred user!
能具体点吗?我是菜鸟。。。。
 
procedure TForm1.Button1Click(Sender: TObject);
var
LocalFile,
RemoteFile: String;
F: File of Byte;
FSize: Integer;
O: TOpenDialog;
begin
NMFTP1.Connect ;
O := TOpenDialog.Create(Self);
try
O.Title := 'Select file to upload';
if O.Execute then
if InputQuery('Choose Remote File Name', 'Filename?', RemoteFile) then
begin
LocalFile := O.FileName;
AssignFile(F, LocalFile);
Reset(F);
FSize := FileSize(F);
CloseFile(F);
NMFTP1.Allocate(FSize);
pgb.Max := FSIZE;//pgb是win32页上的TProgressBar
pgb.Position := 0;
NMFTP1.Upload(LocalFile, RemoteFile);
end;
finally
O.Free;
end;
end;

procedure TForm1.NMFTP1Success(Trans_Type: TCmdType);
begin
pgb.Position := 0;
end;

procedure TForm1.NMFTP1PacketSent(Sender: TObject);
begin
pgb.Position := NMFTP1.BytesSent;
end;
 
后退
顶部