再贴:<br><br>Kingron (2001-12-3 11:12:00) <br>-----------------------------------------------<br>赫赫,找到代码了并且方便Post,就Post出来了:<br>更改IE代理服务器设置,不重新启动IE,代码如下:<br>但如何设置某种协议为一特定地址呢,BYPASS参数怎么用?<br>其实在proxyserver中http=205.207.118.51:80;https=205.207.118.51:80;gopher=205.207.118.51:80;socks=205.207.118.51:80是分别设置,<br>如果只有地址和端口则是所有协议使用相同地址<br>///Coder:Kingron<br>function ChangeProxy(const Proxy, Port,ByPass: string; const bEnabled: boolean = True): boolean;<br>var<br> reg: Tregistry;<br> info: INTERNET_PROXY_INFO;<br> Fproxy:string;<br>begin<br> Result := False;<br> FProxy:=Format('%s:%s',[Proxy,Port]);<br> reg := Tregistry.Create;<br> try<br> reg.RootKey := HKEY_CURRENT_USER;<br> if reg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/Internet Settings', True) then<br> begin<br> reg.Writestring('ProxyServer', Fproxy);<br> reg.WriteInteger('ProxyEnable', integer(bEnabled));<br> info.dwAccessType := INTERNET_OPEN_TYPE_PROXY;<br> info.lpszProxy := pchar(proxy);<br> info.lpszProxyBypass := pchar(ByPass);<br> InternetSetOption(nil, INTERNET_OPTION_PROXY, @info, SizeOf(Info));<br> InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0);<br>// InternetSetOption(nil, INTERNET_OPTION_REFRESH, nil, 0);<br>// Sendmessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);<br> Result:=True;<br> end<br> finally<br> reg.CloseKey;<br> reg.free;<br> end;<br>end;