Re: Problems Using OnWorkBegin, OnWork To Generate Progress Bar

Giganews Newsgroups
Subject: Re: Problems Using OnWorkBegin, OnWork To Generate Progress Bar
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Mon, 10 Sep 2007

"Frank Bishop" <franc…@taconic.net> wrote in message
news:86ECE44BA934E340franc…@taconic.net...

> I'm trying to use onworkbegin onwork onworkend to
> generate a progress bar during getting a list of groups or
> getting a list of headers

You won't be able to.  Not for groups, anyway.

> When Requesting Groups Or Headers I dont Get A
> Starting Value For On Work Begin

That is because there is no value available to report in the first place.
The AWorkCountMax parameter of OnWorkBegin reports the number of bytes that
are expected to be transferred between OnWorkBegin and OnWorkEnd, but only
when that number is actually known available ahead of time, which it is not
in this case.  The lists you are downloading are dynamic in nature.  The
reading of them will not know when to stop until the terminator sequence is
actually received at the end of the reading.

> Should Work Begin Output The Max to be used to define ProgressBar1.Max

Not in this case, no.

> For Both Groups And Headers I'm always getting zero

As you should be.  That is not a bug.  The server does not indicate the
number of groups or headers that will be transferred, so Indy can't report
that back to you.

In the case of headers, however, there is a workaround available.  If you
are using XOVER to download the headers, then you already know ahead of time
the starting and ending MsgIDs that are in a given newsgroup (those are
provided by the MsgLow and MsgHigh properties after calling SelectGroup()).
Since you would also know the MsgIDs that you want to download within that
range, you can estimate the number of messages whose headers you are going
to download, and then update your progress bar accordingly outside of the
OnWork... events.

Gambit

Replies

None

In response to

Problems Using OnWorkBegin, OnWork To Generate Progress Bar posted by Frank Bishop on Sat, 8 Sep 2007