如何设置IE代理服务器~~
那个HttpSetProxy 函数没什么用处啊 我运行了 打开IE还是没有反应 和原来一样 :face (13): 启用代理RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1 )
DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
直接连接
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 0)
DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
DllCall 这一句是关键,用来刷新 InternetSetOption,使修改生效!
[ 本帖最后由 pw4321 于 2008-6-12 23:46 编辑 ] 没啥反应啊 RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "这里填写代理服务器地址", "REG_DWORD", 0) 这是我用来设置Tor代理的:
Local $DInet = RegRead("HKLM\SOFTWARE\Microsoft\RAS AutoDial\Default", "DefaultInternet")
Local $PSvr = StringToBinary("ftp=127.0.0.1:8118;gopher=127.0.0.1:8118;http=127.0.0.1:8118;https=127.0.0.1:8118;socks=127.0.0.1:9050")
$PSvr = StringMid($PSvr, 3)
Local $POve = StringToBinary("192.*;<local>")
$POve = StringMid($POve, 3)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", $DInet, "REG_BINARY", "3C000000010000000300000066000000" & $PSvr & "0D000000" & $POve & "00")
DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
[ 本帖最后由 pw4321 于 2008-6-13 23:24 编辑 ] 当 $PSvr 有变化时上面的方法可能就会失效,所以你最好别用 $PSvr/$POve 这么麻烦,直接用
RegWrite("HKCUSoftwareMicrosoftWindowsCurrentVersionInternet SettingsConnections", $DInet, "REG_BINARY", "3C0000000......") “已解决”区有。。。搜索一下就行。直接写注册表会即时生效的。。。
不过写注册表之后,要重新IE才生效的。如果是IE7要开新页面了。 原帖由 sanhen 于 2008-6-13 23:36 发表 http://www.autoitx.com/images/common/back.gif
“已解决”区有。。。搜索一下就行。直接写注册表会即时生效的。。。
不过写注册表之后,要重新IE才生效的。如果是IE7要开新页面了。
居士是说这个么?http://www.autoitx.com/forum.php?mod=viewthread&tid=674&highlight=%B4%FA%C0%ED
我还是有疑问,那HttpSetProxy这个函数是否废的?我按照帮助文档里的语法试了一下,发现完全没有生效:face (3): 这个函数不是作废,而记得根本不是用在设置IE上代理服务器。。。
而是用在InetGet上的。不知记错没有。你可以测试一下。 HttpSetProxy
--------------------------------------------------------------------------------
设置访问HTTP时使用的代理服务器。 学习收藏
* 启用代理
DllCall 这一句是关键,用来刷新 InternetSetOption,使修改生效!
[ 本帖最后由 pw4321 于 ...
pw4321 发表于 2008-6-12 23:28 http://www.autoitx.com/images/common/back.gif
你写的不能用,我改了下,可以用:
;读取文本,设置变量,我就不写了,下面的就是开启和关闭代理了
$DLIP="http=192.168.0.1:8080";这个就是代理的变量了,你去读取文本内容
$DL=MsgBox(4,"","是否开启代理")
If $DL=6 Then
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD",Hex(1));开启代理
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $DLIP)
DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
MsgBox(0,"开启","代理已经开启")
Else
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD",Hex(0));关闭代理
DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
MsgBox(0,"关闭","代理已经关闭")
EndIf
;核心代码
;RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD",Hex(1))
;RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","www.autoitx.com:8000") DllCall("wininet.dll", "uint", "InternetSetOption", "ptr", 0, "dword", 37, "ptr", 0, "dword", 0)
经测试,这一句会让前两句的修改失效。 本帖最后由 xsjtxy 于 2010-7-7 00:03 编辑
;;;;修改注册表后立即生效的。不需要刷新。但是需要重新打开浏览器。
$ini = @ScriptDir & "\http.cfg"
$i1 = IniRead($ini, "配置", "启用或禁用代理", "")
if $i1 = "" then
IniWrite($ini, "配置", "启用或禁用代理", "禁用")
IniWrite($ini, "配置", "代理服务器IP和端口", "127.0.0.1:8080")
run(@SystemDir & "\notepad.exe " & $ini)
exit
endif
If $CmdLine <> 0 Then
if StringRight($CmdLine,2) = "启用" then auto()
if StringRight($CmdLine,2) = "禁用" then disabled()
endif
;;;;命令行方式调用
if $i1 = "启用" then auto()
if $i1 = "禁用" then disabled()
msgbox(48,"错误","配置文件错误,请检查,或删除后重新配置!")
Func auto()
$i2 = IniRead($ini, "配置", "代理服务器IP和端口", "")
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 1)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer", "REG_SZ", $i2)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyOverride", "REG_SZ", "*.local;<local>")
RegWrite("HKLM\SYSTEM\ControlSet001\Hardware Profiles\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 1)
exit
EndFunc
Func disabled()
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 0)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyOverride", "REG_SZ", "*.local")
RegWrite("HKLM\SYSTEM\ControlSet001\Hardware Profiles\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 0)
exit
EndFunc 请教下加的这两句有何用处?
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyOverride", "REG_SZ", "*.local;<local>")
RegWrite("HKLM\SYSTEM\ControlSet001\Hardware Profiles\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 1) 回复 14# aaeeff
不代理本地地址
页:
[1]
2