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!
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 ]
The Delphi code for Kornel Kisielewicz's answer:
uses Registry, Windows;
function detectIEProxyServer() : string;
begin
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('\Software\Microsoft\Windows\CurrentVersion\Internet Settings', False) then begin
Result := ReadString('ProxyServer');
CloseKey;
end
else
Result := '';
finally
Free;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With