SetProxy: 一个设置IE代理的命令行小工具

IE的代理设置用起来并不方便,我自己而言就要经常更改代理服务器,相信很多人有跟我相同的需要。使用C++编写了一个小程序SetProxy调用Win32 API来设置代理服务器IP,用起来方便多了。

编译后为一个可运行console程序,将它放在\windows\system32目录下,使用时只要运行

SetProxy IP:port

就可以把IP设置好,如果要关闭代理,只需运行

SetProxy ""

命令行中运行,界面较土,但用着方便。可以考虑设置几个快捷方式在桌面或者工具栏,点击即设置代理,其它方式发挥想象。

程序下载地址.

源代码也放在这里,希望有需要的人可以用得上 ;)

源代码下载地址.

这是一份有些年头的代码, 如果你在较新的编译器下编译这个项目, 请先做这里所述的小修改. — Eric on Apr. 9, 2014.

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

11 comments:

    1. Sorry, no Chinese input method installed…

      Try to make this change to the SetProxy.cpp:

      Change
      #include <iostream.h>

      to

      #include <iostream>
      using namespace std;

      The new compiler from MS Visual Studio seems have obsoleted the “<iostream.h>” like headers.

      BTW: this is a plain old piece of code which is written on Windows XP. I am surprised that someone like you tried it. I am surprised again that this piece of code is still working on Windows 7 after I tried it. Good backwards compatibility, MS!

      BTW: Sorry, but who are you? Collage classmate? You are using Visual studio and have interests on command line tools on Windows. There are not many people like this around there except CS students/graduates.

      1. 你说的这俩地方我在看到代码时候就已经改了,可是还是编不过去啊….我Li Yiji…..这两天Evernote同步总是失败,这东西不能自己设代理,又觉得手动改ie代理太麻烦,所以上网搜了一下,然后就搜到你这里了

      2. 咦,你是不是更新了源码的下载链接…我记得以前下载的只有个SetProxy.cpp啊…..这回刚下载的能编译过去了…..

          1. 我在系统里找到了WinInet.h这个文件啊….windows是大小写不敏感的吧,我记得

          2. 这个我就不太知道问题可能在那里了. 你diff下看这个有没有些特殊代码在里面. 另外比较一下编译器在这个project里面的参数设置看有没有特殊的地方. 我当初些这个程序时应该是在32位系统下的.

  1. Thank you very much!
    This really helped because setting the proxy by command line using the registry keys requires the user to open the window “LAN settings” and closing to wake up browsers about the change.
    However, your software really overcomes this problem!

Leave a Reply

Your email address will not be published. Required fields are marked *