给段JavaScript的程序:
var WSHShell = WScript.CreateObject("WScript.Shell");
if(WSHShell.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable")==1)
{
  WSHShell.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable",0,"REG_DWORD");
  WSHShell.Popup("Now the proxy server are disabled!");
}
else
{
  WSHShell.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable",1,"REG_DWORD");
  WSHShell.Popup("Now the proxy server are enabled!");
}
把其保存为proxy.js双击。

解决方案 »

  1.   

    我以前回答过的,为什么不检索一下?
    更改IE代理服务器设置,不重新启动IE,代码如下:
    但如何设置某种协议为一特定地址呢,BYPASS参数怎么用?
    其实在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是分别设置,如果只有地址和端口则是所有协议使用相同地址
    ///Coder:Kingron
    function ChangeProxy(const Proxy, Port,ByPass: string; const bEnabled: boolean = True): boolean;
    var
      reg: Tregistry;
      info: INTERNET_PROXY_INFO;
      Fproxy:string;
    begin
      Result := False;
      FProxy:=Format('%s:%s',[Proxy,Port]);
      reg := Tregistry.Create;
      try
        reg.RootKey := HKEY_CURRENT_USER;
        if reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Internet Settings', True) then
        begin
          reg.Writestring('ProxyServer', Fproxy);
          reg.WriteInteger('ProxyEnable', integer(bEnabled));
          info.dwAccessType := INTERNET_OPEN_TYPE_PROXY;
          info.lpszProxy := pchar(proxy);
          info.lpszProxyBypass := pchar(ByPass);
          InternetSetOption(nil, INTERNET_OPTION_PROXY, @info, SizeOf(Info));
          InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0);
    //      InternetSetOption(nil, INTERNET_OPTION_REFRESH, nil, 0);
    //      Sendmessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);
          Result:=True;
        end
      finally
        reg.CloseKey;
        reg.free;
      end;
    end;