用进度条显示下载进度的问题?

chenjun716 2005-11-09 10:41:31
void __fastcall TForm1::IdFTP1WorkBegin(TObject *Sender,
TWorkMode AWorkMode, const int AWorkCountMax)
{

Application->ProcessMessages();
CGauge1->MaxValue = AWorkCountMax;//下载时得不到AWorkCountMax的值,上传时可以。
}
请高人帮忙!
...全文
240 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenjun716 2005-11-16
  • 打赏
  • 举报
回复
问题已解决,结帐!
chuwanfeng 2005-11-15
  • 打赏
  • 举报
回复
估计你也是一次下载多个文件,我也遇到同样的问题,解决方法如下
先声明一个变量,变量的作用是获得已下载字节

#include <vcl.h>
#pragma hdrstop

#include "down_s.h"
#include "main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//遍历一个FTP目录下载(AFile远程游戏路径,BFile本地游戏路径)
void Down(TIdFTP * idFTP1,AnsiString AFile,AnsiString BFile,TStringList * ls1,TStringList * ls3);
//变量声明--------------------------------------------------------------------------
//已下载字节
double bitTOtran;


再在down函数中获得得正下载的文件的字节

void Down(TIdFTP * idFTP1,AnsiString AFile,AnsiString BFile,TStringList * ls1,TStringList * ls3){

bitTOtran=idFTP1->Size(filename/*下载的文件名*/);//此处获得正下载的文件大小,注意是在get之间
idFTP1->Get(filename,L_filename/*本地文件名*/,true);

}


然后,IdFTP1WorkBegin中,赋值
ProgressBar1->Max=bitTOtran;



最近也在做一个IdFTP的软件,欢迎互相交流,加我QQ36256471注明是BCB就行了
chenjun716 2005-11-10
  • 打赏
  • 举报
回复
还是不行,这些值我觉得应该是组件自己获取的吧,是不是这个组件有BUG?

TWorkBeginEvent = procedure (Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer) of object;

Description

TWorkBeginEvent is the event used to indicate that the component is about to read data from the peer or send data to the peer.
AWorkMode is the TWorkMode value that indicate the operation to be performed.
AWorkCountMax is the number of bytes expected for this operation, or 0 when no value is provided.
constantine 2005-11-09
  • 打赏
  • 举报
回复
CGauge1->MaxValue = IdFTP1.Size(Name);
也就是你自己保存下载的文件大小就可以了
chenjun716 2005-11-09
  • 打赏
  • 举报
回复
我也想过,但在哪里保存呢?
IdFTP1WorkBegin在里面保存不会影响上传吗?

我刚发现是好的,不用改,但很不稳定,时好时坏/

1,316

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧