Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Progress bar to downloading with WinHttp

83 views
Skip to first unread message

Marcin Domaslawski

unread,
Dec 13, 2006, 7:10:23 AM12/13/06
to
Hi,
I use WinHttp to download files/pages from http or https sites. I need an
progress bar but I can't find out how to get size of file which will be
downloaded.

I thought about WinHttpQueryHeaders and WINHTTP_QUERY_CONTENT_LENGTH but it
returns NULL and 12150 error code (I tried it on downloading EXE file).

Any idea ?


Marcin Domaslawski


jim kane

unread,
Dec 13, 2006, 9:53:46 PM12/13/06
to
my approach is to call
WinHttpQueryHeaders on the hRequest with parameters
WinHttp_Query_Raw_Headers_CRLF
WinHttp_header_Name_By_Index
0, !null buffer pointer
&BufSize
WinHttp_No_header_Index )

To get the needed buffer size, allocate and then call again with a proper
pointer.
Then parse the buffer (case insensitive) for several headers I need
including 'Content-Length:'
Jim Kane


"Marcin Domaslawski" <mil...@wp.pl> wrote in message
news:eloqkd$kgl$1...@atlantis.news.tpi.pl...

0 new messages