Here's another method that I use, which doesn't require direct registry access. This works under D2007, but I can't see why it wouldn't work under D7.
uses
WinInet,
SysUtils;
function UseIEProxyInfo(var ProxyHost: String; var ProxyPort: Integer): Boolean;
var
ProxyInfo: PInternetProxyInfo;
Len: LongWord;
ProxyDetails: String;
s2: String;
i1: Integer;
procedure RemoveProtocol(var str: string);
var
i1 : integer;
begin
i1 := PosText('://', str);
if i1 > 0 then
Delete(str, 1, i1 + 2);
i1 := PosText('http=', str);
if i1 > 0 then begin
Delete(str, 1, i1 + 4);
str := SubStr(str, 1, ' ');
end;
end;
begin
Result := False;
Len := 4096;
GetMem(ProxyInfo, Len);
try
if InternetQueryOption(nil, INTERNET_OPTION_PROXY, ProxyInfo, Len) then
begin
if ProxyInfo^.dwAccessType = INTERNET_OPEN_TYPE_PROXY then
begin
Result := True;
ProxyDetails := ProxyInfo^.lpszProxy;
RemoveProtocol(ProxyDetails);
s2 := SubStr(ProxyDetails, 2, ':');
if s2 <> '' then
begin
try
i1 := StrToInt(s2);
except
i1 := -1;
end;
if i1 <> -1 then
begin
ProxyHost := SubStr(ProxyDetails, 1, ':');
ProxyPort := i1;
end;
end;
end;
end;
finally
FreeMem(ProxyInfo);
end;
end;