Discussion:
InternetOpenUrl() hangs when "Automatically detect settings" is ch
(too old to reply)
Randy Hawkins
2005-03-18 14:35:02 UTC
Permalink
My code hangs on the following call to InternetOpenURL() (some code has been
removed for brevity) if I have "Automatically detect settings" checked in
Control Panel (Control Panel->Internet Options->Connections tab->LAN Settings
button):

hINet = ::InternetOpen( AGENT_NAME.c_str(), INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);

if( hINet)
{
hHttpFile = InternetOpenUrl( hINet, (const char *)
url.c_str(), REFERER.c_str(), REFERER.length(), INTERNET_FLAG_RELOAD, 0);
<do stuff>
}


I do not use a Proxy Server and did not have this option checked on my
machine. But, others in the office, who also do not use a Proxy Server, had
it checked (for some reason?!?!?) and the app would hang. Unchecking the
option solved the problem.

I can reproduce the 'hang' on my box by simply selecting the option.

Internet Explorer opens the same URL I am trying to open. Why would this
option be checked? How do I work around this? Can I detect this situation
where the option is checked but no Proxy Server is used? And, if so, what do
I do then?

What additional info is needed to help present my specific situation?

Thanks,
Randy
Michael Adamovic
2005-03-31 10:04:17 UTC
Permalink
Hi Randy,

make a call to InternetQueryOption with option set to INTERNET_OPTION_PROXY.

In the returned struct

typedef struct {
DWORD dwAccessType;
LPCTSTR lpszProxy;
LPCTSTR lpszProxyBypass;
} INTERNET_PROXY_INFO,
* LPINTERNET_PROXY_INFO;

you will find, that lpszProxy is empty.

Hope that helps.

Michael

"Randy Hawkins" <Randy ***@discussions.microsoft.com> schrieb im
Newsbeitrag news:DACF08B3-D1FF-44C1-A73F-***@microsoft.com...
My code hangs on the following call to InternetOpenURL() (some code has been
removed for brevity) if I have "Automatically detect settings" checked in
Control Panel (Control Panel->Internet Options->Connections tab->LAN
Settings
button):

hINet = ::InternetOpen( AGENT_NAME.c_str(), INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);

if( hINet)
{
hHttpFile = InternetOpenUrl( hINet, (const char *)
url.c_str(), REFERER.c_str(), REFERER.length(), INTERNET_FLAG_RELOAD, 0);
<do stuff>
}


I do not use a Proxy Server and did not have this option checked on my
machine. But, others in the office, who also do not use a Proxy Server, had
it checked (for some reason?!?!?) and the app would hang. Unchecking the
option solved the problem.

I can reproduce the 'hang' on my box by simply selecting the option.

Internet Explorer opens the same URL I am trying to open. Why would this
option be checked? How do I work around this? Can I detect this situation
where the option is checked but no Proxy Server is used? And, if so, what
do
I do then?

What additional info is needed to help present my specific situation?

Thanks,
Randy

Loading...