2012-07-01 39 views
0

我想使用代理來掩蓋我的網上衝浪網絡自動瀏覽器! 這是我的代碼:自動代理IE對象

#NoTrayIcon 
#include <GUIConstants.au3> 
#Include <IE.au3> 
#include <GUIConstantsEx.au3> 
GUICreate("Web Browser By EMP£!!",800,600) 
GUISetBkColor(0x808080) 
GUISetState(@SW_SHOW) 
$Edit=GUICtrlCreateInput("http://www.whatismyip.com/",20,20,500,20) 
$Vai=GUICtrlCreateButton("SURF!!!",600,10,150,50) 
$oIE = ObjCreate("Shell.Explorer.2") 
GUICtrlCreateObj($oIE, 10, 90,780, 500) 
$ret = HttpSetProxy(2,"61.163.78.51:3128") 
If $ret == 0 Then 
    MsgBox(0, "Proxy", "Proxy Error") 
    Exit 
EndIf 
While 1 
$msg=GUIGetMsg() 
    Switch $msg 
    Case $Vai 
$Link=GUICtrlRead($Edit) 
_IENavigate($oIE,($Link)) 
    GUICtrlSetData($Edit,$Link) 
    Case $GUI_EVENT_CLOSE 
    Exit 
     EndSwitch 
WEnd 

我瀏覽上http://www.whatismyip.com/,我可以看到我的真實IP地址!我想隱藏一個代理!

回答

1

HttpSetProxy功能僅用於InetGet,它對Internet Explorer設置沒有任何影響。爲了製作Internet Explorer窗口的代理,您需要更改Internet Explorer設置。

我會做的方式是這樣的:

#include <GUIConstants.au3> 
#include <IE.au3> 
#include <GUIConstantsEx.au3> 

Global Const $sInetSettingsKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" 

GUICreate("Web Browser By EMP£!!", 800, 600) 
GUISetBkColor(0x808080) 
GUISetState(@SW_SHOW) 
$Edit = GUICtrlCreateInput("http://www.whatismyip.com/", 20, 20, 500, 20) 
$Vai = GUICtrlCreateButton("SURF!!!", 600, 10, 150, 50) 
$oIE = ObjCreate("Shell.Explorer.2") 
GUICtrlCreateObj($oIE, 10, 90, 780, 500) 

MySetProxy("61.163.78.51:3128") 

While 1 
    $msg = GUIGetMsg() 
    Switch $msg 
     Case $Vai 
      $Link = GUICtrlRead($Edit) 
      _IENavigate($oIE, ($Link)) 
      GUICtrlSetData($Edit, $Link) 
     Case $GUI_EVENT_CLOSE 
      ExitLoop 
    EndSwitch 
WEnd 

MySetProxy() 

Func MySetProxy($sProxy = "", $fEnable = True) 
    Local Static $sPrev = "" 
    Local Static $fWasEnabled = False 

    If $sProxy = "" Then 
     If $sPrev <> "" Then __setProxyInfo($fWasEnabled, $sPrev) 
    Else 
     If $sPrev = "" Then 
      $sPrev = RegRead($sInetSettingsKey, "ProxyServer") 
      $fWasEnabled = RegRead($sInetSettingsKey, "ProxyEnable") 
     EndIf 

     __setProxyInfo($fEnable, $sProxy) 
    EndIf 
EndFunc 

Func __setProxyInfo($fEnabled, $sProxy) 
    RegWrite($sInetSettingsKey, "ProxyEnable", "REG_DWORD", 1) 
    RegWrite($sInetSettingsKey, "ProxyServer", "REG_SZ", $sProxy) 
EndFunc 

whatismyip.com不喜歡它雖然很多。但IP地址絕對改變了。