Article View: borland.public.cppbuilder.nativeapi
Article #2470WinInet, InternetOpen and Proxy settings...
From: Mike Collins
Date: Wed, 21 Feb 2007 21:12
Date: Wed, 21 Feb 2007 21:12
39 lines
2131 bytes
2131 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:
<45dcb57b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8d28b2a3d9a6eaf6,start 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 21:12:02 -0000 Lines: 42 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: <45dcb57b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172092283 89.241.207.15 (21 Feb 2007 13:11:23 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail