HELP:用Delphi动态修改ie属性(100分)

  • 主题发起人 主题发起人 coki
  • 开始时间 开始时间
C

coki

Unregistered / Unconfirmed
GUEST, unregistred user!
我最近写了一个小程序,是在ie的toolsbar上加了个按钮,由此来控制是否通过代理服务器上网。<br>是通过修改注册表来实现的。但是每次打开或关闭代理服务器后一定要重新启动ie才能够生效。 <br>请哪位指点一下怎样才能够使改动立即生效。<br>
 
再贴:<br><br>Kingron (2001-12-3 11:12:00) &nbsp;<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>&nbsp; reg: Tregistry;<br>&nbsp; info: INTERNET_PROXY_INFO;<br>&nbsp; Fproxy:string;<br>begin<br>&nbsp; Result := False;<br>&nbsp; FProxy:=Format('%s:%s',[Proxy,Port]);<br>&nbsp; reg := Tregistry.Create;<br>&nbsp; try<br>&nbsp; &nbsp; reg.RootKey := HKEY_CURRENT_USER;<br>&nbsp; &nbsp; if reg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/Internet Settings', True) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; reg.Writestring('ProxyServer', Fproxy);<br>&nbsp; &nbsp; &nbsp; reg.WriteInteger('ProxyEnable', integer(bEnabled));<br>&nbsp; &nbsp; &nbsp; info.dwAccessType := INTERNET_OPEN_TYPE_PROXY;<br>&nbsp; &nbsp; &nbsp; info.lpszProxy := pchar(proxy);<br>&nbsp; &nbsp; &nbsp; info.lpszProxyBypass := pchar(ByPass);<br>&nbsp; &nbsp; &nbsp; InternetSetOption(nil, INTERNET_OPTION_PROXY, @info, SizeOf(Info));<br>&nbsp; &nbsp; &nbsp; InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0);<br>// &nbsp; &nbsp; &nbsp;InternetSetOption(nil, INTERNET_OPTION_REFRESH, nil, 0);<br>// &nbsp; &nbsp; &nbsp;Sendmessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);<br>&nbsp; &nbsp; &nbsp; Result:=True;<br>&nbsp; &nbsp; end<br>&nbsp; finally<br>&nbsp; &nbsp; reg.CloseKey;<br>&nbsp; &nbsp; reg.free;<br>&nbsp; end;<br>end;
 
InternetSetOption()使自己定义的函数吗?
 
uses WinInet;
 
hoho,我以前就用过internetsetoption,不过,对一些ie选项有效,<br>但对proxy,无效。
 
这个对Proxy有效的,我试过了。
 
后退
顶部