Board index » cppbuilder » Determining progress with TCppWebBrowser

Determining progress with TCppWebBrowser


2008-05-27 11:31:30 PM
cppbuilder86
Hay guys, just a {*word*218}.
I'm using a TCppWebBrowser to display a sort of HTML based help / user
guide, embedded into one of my forms.
The help.html is quite large and it takes a while to load. Whilst the
application does display the hourglass cursor, i'd like to give some
progress feedback on the percentage loaded.
I've looks at the various events for the CppWebBrowser but non seem to
return anything consistent. Imparticular i looked at the OnProgressChange,
OnStateChange and OnDocumentComplete. The values returned during
OnProgressChange are random and bare not reflection to the loading of the
document i.e. 1000, -2 etc.
Does anyone know a better way of doing this?
Many thanks in advance,
Mike C
 
 

Re:Determining progress with TCppWebBrowser

"Mike Collins" <its@TheBottomOfThePost>wrote in message
Quote
The values returned during OnProgressChange are random and
bare not reflection to the loading of the document i.e. 1000, -2 etc.
Keep in mind that the browser may be downloading multiple files at a time
(pages, frames, images, sounds, etc).
Gambit
 

Re:Determining progress with TCppWebBrowser

Cheers,
I'm just basing it on what i see, I get nothing, then when the page starts
to display i get a 1000, then a -2, then a -1 to signify that the page has
loaded. I saw a post you made sometime ago which confirms the unreliability
of this method but i though maybe someone had worked out a better system :-)
Thanks anyway...
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Mike Collins" <its@TheBottomOfThePost>wrote in message
news:483c1895$ XXXX@XXXXX.COM ...
 

{smallsort}

Re:Determining progress with TCppWebBrowser

"Mike Collins" <its@TheBottomOfThePost>wrote in message
Quote
i though maybe someone had worked out a better system :-)
You could always download the files yourself via any HTTP component/library
of your choosing, and then display them in the TCppWebBrowser afterwards.
Gambit
 

Re:Determining progress with TCppWebBrowser

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
You could always download the files yourself via any HTTP
component/library of your choosing, and then display them in the
TCppWebBrowser afterwards.
My mistake. I did not read that you were loading a local file. In which
case, one thing you could try is write a custom TStream class that reads the
file data, and then use the browser's IPersistStreamInit interface to load
the TStream via the VCL's TStreamAdapter class (which wraps a TStream with
an IStream interface). Your TStream class could then override the virtual
Read() method to update a progress display as needed.
Gambit
 

Re:Determining progress with TCppWebBrowser

Bingo, that is exaclty whay i was looking form.
To get the help system demo'ed, i was loading the html from a file but in
actual fact, i was going to load it from a resource file using the
TStreamAdapter, as you have suggested.
Thanks again remy - as always...
Mike
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>You could always download the files yourself via any HTTP
>component/library of your choosing, and then display them in the
>TCppWebBrowser afterwards.

My mistake. I did not read that you were loading a local file. In which
case, one thing you could try is write a custom TStream class that reads
the file data, and then use the browser's IPersistStreamInit interface to
load the TStream via the VCL's TStreamAdapter class (which wraps a TStream
with an IStream interface). Your TStream class could then override the
virtual Read() method to update a progress display as needed.


Gambit