Discussion:
Progress bar to downloading with WinHttp
(too old to reply)
Marcin Domaslawski
2006-12-13 12:10:23 UTC
Permalink
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
2006-12-14 02:53:46 UTC
Permalink
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
Post by Marcin Domaslawski
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
Loading...