Re: Get Download Status; C++; IdFTPClient

Giganews Newsgroups
Subject: Re: Get Download Status; C++; IdFTPClient
Posted by:  Joe Pool (jpo…@letourneau-inc.com)
Date: Wed, 7 Sep 2005

Hold off a moment;  I'm going to try to get Gambit's reply to post "Problems
creating a progress bar for TidFTP" to work.  If I forget to update this
later, someone remind me and I'll give out my solution.

"Joe Pool" <jpo…@letourneau-inc.com> wrote in message
news:44AD1BAA56D9E240jpo…@letourneau-inc.com...
> How can I determine the progress of a download (i.e. to update a Progress
> Bar)?
>
> Below is a "mock-up" of my code.
>
> void GetUpdate(void* params)  {
>  ...
>  TIdFTPListItem* Item = new TIdFTPListItem(NULL);
>  try {
>    IdFtp1->Connect(true);                        // Open a connection
>    IdFtp1->List(NULL, "", true);
>    do  {
>      Item = IdFtp1->DirectoryListing->Items[i++];
>      if (Item->FileName == "setup.exe")  {
>        ProgressBar1->Max = Item->Size;          // assign setup.exe Size
> to Max
>        FileStream = new TFileStream("C:\setup.exe", fmCreate |
> fmShareDenyWrite);
>        IdFtp1->Get(Item->FileName, FileStream);  // download the file
>        i = IdFtp1->DirectoryListing->Count + 1;  // forces to exit the
> loop
>      }
>    } while (IdFtp1->DirectoryListing->Count > i);
>  } __finally  {
>    IdFtp1->Quit();                              // Close FTP Connection
>  }
>  ...
> }
>
> The file transfers to my local computer, but I do not know how to update a
> progress bar with ProgressBar1->Position.  Any ideas?
>
> Regards,
> Joe

Replies

In response to

Get Download Status; C++; IdFTPClient posted by Joe Pool on Wed, 7 Sep 2005