How use and change a proxy for ActiveX Shell.Explorer ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Zelio
Posts: 278
Joined: 30 Sep 2013, 00:45
Location: France

How use and change a proxy for ActiveX Shell.Explorer ?

15 Mar 2015, 16:48

There is an elegant way ? For example a WB.proxy method ? Or I have to use the IE registry, and reload the script ?

Code: Select all

proxy := "XXX.XXX.XXX.XXX:8080"
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyEnable, 1
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyServer, % proxy

Code: Select all

;http://ahkscript.org/boards/viewtopic.php?f=7&t=879

#NoEnv  
#SingleInstance, Force
SetWorkingDir %A_ScriptDir%

Gui Add, Edit, w930 r1 vURL, http://www.whatsmyip.us/imgcode.php
Gui Add, Button, x+6 yp w44 Default, Go
Gui Add, ActiveX, xm w980 h640 E0x10000 vWB, Shell.Explorer
ComObjConnect(WB, WB_events)

;NO ERROR
WB.silent := true
ComObjError(0)

IOleInPlaceActiveObject_Interface := "{00000117-0000-0000-C000-000000000046}"
pipa := ComObjQuery( WB, IOleInPlaceActiveObject_Interface )
TranslateAccelerator := NumGet( NumGet( pipa+0 ) + 20 )
   
OnMessage( 0x0100, "WM_KeyPress" ) ; WM_KEYDOWN
OnMessage( 0x0101, "WM_KeyPress" ) ; WM_KEYUP  
OnExit, GuiClose

Gui Show


ButtonGo:
 Gui Submit, NoHide
  WB.Navigate(URL)
Return


class WB_events
{
    NavigateComplete2(wb, NewURL)
    {
        GuiControl,, URL, %NewURL%  ; Update the URL edit control.
    }

    DocumentComplete( WB, NewURL )
    {
        ; check all frames and elements for input focus
        ; WB.Document.Body.Focus()
    }    
}


GuiClose:
  ObjRelease( pipa )
  OnExit
  ExitApp
Return  



WM_KeyPress( wParam, lParam, nMsg, hWnd ) {

Global WB, pipa, TranslateAccelerator
Static Vars := "hWnd | nMsg | wParam | lParam | A_EventInfo | A_GuiX | A_GuiY"

  WinGetClass, ClassName, ahk_id %hWnd%

  If ( ClassName = "Shell DocObject View" && wParam = 0x09 ) {
    WinGet, hIES, ControlListHwnd, ahk_id %hWnd% ; Find child of 'Shell DocObject View'
    ControlFocus,, ahk_id %hIES%
    Return 0
  }

  If ( ClassName = "Internet Explorer_Server" ) {

    VarSetCapacity( MSG, 28, 0 )                   ; MSG STructure    http://goo.gl/4bHD9Z
    Loop, Parse, Vars, |, %A_Space%
      NumPut( %A_LoopField%, MSG, ( A_Index-1 ) * 4 )

    Loop 2  ; IOleInPlaceActiveObject::TranslateAccelerator method    http://goo.gl/XkGZYt
      r := DllCall( TranslateAccelerator, UInt,pipa, UInt,&MSG )
    Until wParam != 9 || WB.document.activeElement != ""

    IfEqual, R, 0, Return, 0         ; S_OK: the message was translated to an accelerator.

  }
}
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: How use and change a proxy for ActiveX Shell.Explorer ?

17 Mar 2015, 04:16

Search for "webbrowser proxy", most of the results points to InternetSetOption.
One of the results: https://social.msdn.microsoft.com/Forum ... m=winforms

I don't know how to translate it to AHK code. Wait you or someone else... :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 436 guests