Re: Problem understanding how WebBrowser Control communicates with APP

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 04/22/04


Date: Thu, 22 Apr 2004 13:09:05 -0400


"Martin Payne" <martin@microcosm.co.uk> wrote in message
news:4087f610.30657232@news.eclipse.co.uk
> (this is as expected but now comes the wierd bit):
>
> image1:
>
> B start
> A ReportData
> A ReportData (why twice?)

ReportData may be called many times, as the data gets downloaded and
becomes available. This is expected behavior.

> A ReportResult S_OK (why - it hasn't read anything yet???)

ReportResult indicates that the data has been successfully downloaded,
not that is has been fully read.

> then it goes straight to image 2 without reading image 1:

The two images get downloaded independently and in parallel, so the
calls to their corresponding APPs may be interleaved in arbitrary and
unpredictable ways. I'm not sure why you expect a certain order.

> B start
> A ReportData (twice)
> A ReportResult
> B Read 512 bytes multiple times for Image 1
> B Terminate
> B Read 512 bytes multiple times for Image 2
> B Terminate
>
> I am totally confused as to why it does this. Why cannot it do Start,
> Read, Terminate for each file in turn?

Why should it? If you have a page with 100 images, each from different
server, would you really want the browser to download them one by one,
if your bandwidth permits them to be downloaded in parallel?

> I am writing my own APP for file protocol and it is OK but not for
> this page. It only displays a small part of image1 because it quickly
> gives up and starts looking for image2.

Huh? For each download operation, a new instance of an APP is created.
Each instance should maintain its own state. It looks like you share
state between all instances - that's a bug in your design. Fix it.

> In the above example how does the APP know whether the read is for
> file1 or for file 2?

It should read from whatever file name was passed to
IInternetProtocol::Start

-- 
With best wishes,
    Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken