从以前的帖子里翻出来的
webbrowser代理其实就是用IE的internet选项里的代理设置,用下面的方法可以修改IE的代理设置:
uses wininet, HTTPApp, HttpProxy;
procedure SetIEProxy(AProxy: String);
var
inf: INTERNET_PROXY_INFO;
len: DWord;
begin
if trim(AProxy) <> '' then
begin
inf.dwAccessType := INTERNET_OPEN_TYPE_PROXY;
inf.lpszProxy := pchar(AProxy);
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;