Article View: borland.public.cppbuilder.nativeapi
Article #2471WinInet, InternetOpen and Proxy settings...
From: Mike Collins
Date: Wed, 21 Feb 2007 18:26
Date: Wed, 21 Feb 2007 18:26
39 lines
2217 bytes
2217 bytes
Hi all, just a quick question on using proxy settings with InternetOpen.
I have a live update system in place which works perfectly, however, some
customers have come back and requested the facility to input and use a proxy
server. Having looked at the MSDN reference it seemed pretty easy to
implement this within the initial InternetOpen call.
My code looks like this:
DWORD dwAccessType;
AnsiString szProxySz;
if (getProxyOptions())
{
dwAccessType = INTERNET_OPEN_TYPE_PROXY;
szProxySz = AnsiString("\"\"http=http://" + getProxyAddress() + ":" +
getProxyPortNum() + "\"\"");
}
else
{
dwAccessType = INTERNET_OPEN_TYPE_DIRECT;
szProxySz = NULL;
}
hINetHnd = InternetOpen(TEXT("Live Update"), dwAccessType,
szProxySz.c_str(), NULL, 0);
if (!hINetHnd)
throw EAbort(SysErrorMessage(GetLastError()), 0);
When no proxy setting are enabled, the code works without problem. When
they are enabled, with valid values, the InternetOpen call fails and
GetLastError returns, "Parameter are Incorrect"
Just a quick point before anyone suggests it, I can't use the preconfigured
proxy settings because of the context that my code is running in. Does
anyone have any ideas what I'm doing wrong here?
Many thanks in advance,
Mike C
Technical Details
Message-ID:
<45dcb57a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!news.maxwell.syr.edu!ucberkeley!news-hog.berkeley.edu!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8d28b2a3d9a6eaf6 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Collins" <its@TheBottomOfThePost.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: WinInet, InternetOpen and Proxy settings... Date: Wed, 21 Feb 2007 18:26:10 -0000 Lines: 41 Organization: SDA Ltd X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.2826 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 NNTP-Posting-Host: 89.241.207.15 Message-ID: <45dcb57a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172092282 89.241.207.15 (21 Feb 2007 13:11:22 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!news.maxwell.syr.edu!ucberkeley!news-hog.berkeley.edu!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail