uses Windows, Wininet,......;
//设置 IE 代理服务器, ProxyProt: "IP:端口", 为空时取消代理
//利用 INTERNET_OPTION_PROXY 及 INTERNET_OPTION_SETTINGS_CHANGED 兩函數。不需改註冊表。
procedure TMyIE.SetProxy(ProxyProt :string);
var
inf :INTERNET_PROXY_INFO;
len
Word;
begin
if (ProxyProt <> '') then begin
inf.dwAccessType := INTERNET_OPEN_TYPE_PROXY;
inf.lpszProxy := pchar(ProxyProt);
inf.lpszProxyBypass := nil;
len := sizeof(inf);
InternetSetOption(nil, INTERNET_OPTION_PROXY, @inf, len);
InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0);
end
else begin
inf.dwAccessType := INTERNET_OPEN_TYPE_DIRECT;
inf.lpszProxy := nil;
inf.lpszProxyBypass := nil;
len := sizeof(inf);
InternetSetOption(nil, INTERNET_OPTION_PROXY, @inf, len);
InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0);
end;
end;