Article View: borland.public.cppbuilder.internet.web
Article #450Re: downloading with wininet
From: Boba
Date: Tue, 02 Jan 2007 16:36
Date: Tue, 02 Jan 2007 16:36
40 lines
2264 bytes
2264 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:459a2c13$1@newsgroups.borland.com...
> ...
> > LPCSTR szAcceptTypes[] = { "*.*", NULL };
>
> That is wrong. HttpOpenRequest() expects a media ContentType mask,
> not a filename mask. At the verly least, you need to change *.*" to
> "*/*", ie:
...hmmm... both gave the same result. i wish i knew why.
> LPCSTR szAcceptTypes[] = { "*/*", NULL };
>
> > hHttpRequest = HttpOpenRequest( hHttpSession, "GET",
> szFileName,
> > "HTTP/1.1", NULL,
> szAcceptTypes,
> > INTERNET_FLAG_RELOAD, 0 );
>
> What exactly are you passing as the szFileName? It needs to be a URL
> relative to the root of the server, not a local file path.
here's a sample call: DownloadFile("download.microsoft.com",
"/download/6/a/f/6af940c1-2774-4ebb-8546-2c83068af231/Windows2000-KB926247-x86-E
NU.EXE");
> Why are you passing the server name separately from the filename in the first
> place?
that's the way 'they' want.
> I suggest you use HttpQueryInfo() to retreive the size of the data
> before then entering the loop.
InternetQueryDataAvailable() is supposed to do that.
> That way you know when to stop looping properly.
if no (more) data avalable, dwBytesDownloaded will be set 0
by the InternetReadFile() call.
Technical Details
Message-ID:
<459a89d6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4599f9c5@newsgroups.borland.com> <459a2c13$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,66a46201c905b896 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Boba" <Boba@somewhere.world> Newsgroups: borland.public.cppbuilder.internet.web References: <4599f9c5@newsgroups.borland.com> <459a2c13$1@newsgroups.borland.com> Subject: Re: downloading with wininet Date: Tue, 2 Jan 2007 10:36:23 -0600 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 65.243.37.30 Message-ID: <459a89d6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1167755734 65.243.37.30 (2 Jan 2007 08:35:34 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail