程序的目的的批量查询代理地址是否可用。但是用_IENavigate打开后,无法关闭Gui窗口,更无法再次更改代理设置。不知道问题出在什么地方。
大家看看。#include <IE.au3>
#include <WinAPI.au3>
$dailis="187.0.191.166:8080,221.130.17.242:80,222.58.227.137:3128"
$daili=StringSplit($dailis,",",2)
For $mydaili In $daili
If @error = -1 Then ExitLoop
MsgBox(0,"","使用代理"&$mydaili)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 1)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer", "REG_SZ", $mydaili)
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)
openie()
Next
Func openie()
_IEErrorHandlerRegister()
Global $oIE = _IECreateEmbedded()
$url = "http://www.ip138.com"
GUICreate("mytest", 700, 600, (@DesktopWidth - 700) / 2, (@DesktopHeight - 600) / 2)
GUICtrlCreateObj($oIE, 0, 0, 700, 600)
AutoItSetOption("TrayIconHide", 1)
GUISetState(@SW_SHOW)
_IENavigate($oIE, $url,0)
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 0)
RegWrite("HKLM\SYSTEM\ControlSet001\Hardware Profiles\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings","ProxyEnable", "REG_DWORD", 0)
Sleep(5000)
WinClose("mytest")
EndFunc
|