How can a Delphi application detect the network proxy settings of a Windows PC?

devstopfix picture devstopfix · Jan 6, 2010 · Viewed 8.1k times · Source

I have a Delphi application that communicates with web servers on the Internet using the Indy components. Most users of the application have direct Internet connections but some are behind a proxy server of a local network. I don't want to have to ask the users to lookup their proxy server in the Internet Options / Connections / LAN Settings dialog

alt text http://toybase.files.wordpress.com/2008/11/ie-proxy-settings.png

as quite frankly most people won't know or care what this setting is.

Can I get this information via some system calls from a Delphi-7 appplication?

Many thanks!

Answer

Kornel Kisielewicz picture Kornel Kisielewicz · Jan 6, 2010

Via WinAPI -- WinHttpGetIEProxyConfigForCurrentUser. You gotta love MS's long WINAPI names ^_^.

After OP edit: You can read from the registry, AFAIR it would be located here :

 [ HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings ]