I have very little experience of Http programming and wondered if anyone
could advise me about what happens and when it happens behind the scenes
when I use CInternetSession::OpenUrl. Specifically, I'm wondering about when
bytes are actually available for reading. The background is that I want to
download and display a progressive jpeg. I'm using a file pointer obtained
with the following code:-
iSession = new CInternetSession (_T("Zoom Viewer/1.0"), 1,
PRE_CONFIG_INTERNET_ACCESS, NULL, NULL, INTERNET_FLAG_DONT_CACHE);
iStream = iSession->OpenURL(urlName, 1, INTERNET_FLAG_TRANSFER_BINARY, NULL,
0);
I'd like to begin displaying the progressive jpeg as soon as the bytes
arrive, however I'm not sure if the mechanism I'm using actually buffers the
entire Url before I get the first byte with an iStream->Read(....). If it
does then I might as well read the whole jpeg and be done with it.
The other question I have concerns doing an iStream->Seek(..) followed by an
iStream->Read(...). In this case the Url must surely be downloaded entirely
(or at least as far as the Seek) ??
Is there any mechanism for getting specific bytes from a Url without
customised server side code? And what would be the usual mechanism for
displaying progressive jpegs?
Thanks a lot
Jeff
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Jeff" <som...@somewhere.com> wrote in message
news:jWzXj.39801$Nq2....@newsfe29.ams2...
Hi, thanks for the response.
No, I'm not interested in displaying a progress bar, I just want to display
the different stages of the progressive jpeg as soon as they arrive.
But if the operation of the CInternetSession::OpenURL involves downloading
the entire URL before any bytes are available to the Read(..) operation then
there is no point in displaying a partial quality jpeg - better to just
display the entire full quality jpeg.
I'm hoping that the Read(..) operation will return as soon as the requested
bytes have been downloaded to my machine from the server. What worries me is
that this object also provides a Seek(..) operation and the only way I can
see for that to work is if the entire URL is first downloaded into a local
buffer.
Thanks again
Jeff
This will allow you to display the image chunk by chunk while it is
downloading. There are many examples in the internet on how to issue a GET
request and read the data. You may search in the internet, or take a look at
one of my examples, which I did in the past. Please take into account, that
the example is using WinHTTP, and not WinInet, but I think this is plus,
because WinHTTP is more advanced version of WinInet. Example can be
downloaded here:
http://msmvps.com/blogs/v_scherbina/pages/winhttp-amp-wininet-examples.aspx
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Jeff" <som...@somewhere.com> wrote in message
news:WkdYj.26504$EH5....@newsfe30.ams2...
Thanks a million Volodymyr - that looks just the job!
Jeff
Hello again
I included something similar to your example in a small activeX I'm
developing and it works fine.
If I embed this activeX into an internet browser such as IE what can I do to
ensure that the http requests are fed by the Browser's cache rather than the
original server. Or does this come free with WinHTTP?
Thanks again.
Jeff
Sorry for a delayed answer. Ironically, IE7 uses WinInet and WinHTTP (you
can check this by loading the IE7 into debuger, such as WinDbg or OllyDbg,
and looking at list of loaded modules), so I don't think your WinHTTP driven
application will be able to use the whole IE cache.
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.