#include <GUIConstants.au3>

$oIE        = ObjCreate("Shell.Explorer.2")
$SinkObject = ObjEvent($oIE,"IEEvent_","DWebBrowserEvents")

GUICreate ( "Embedded Web control Test", 640, 780,(@DesktopWidth-640)/2, (@DesktopHeight-780)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUIActiveX         = GUICtrlCreateActiveX  ( $oIE,         10,  10, 600, 400 )
$GUI_Progress       = GUICtrlCreateProgress (               10, 470, 600,  20 )
$GUI_Button_Back    = GuiCtrlCreateButton   ( "Back",       10, 420, 100,  30 )
$GUI_Button_Forward = GuiCtrlCreateButton   ("Forward",     120, 420, 100,  30 )
$GUI_Button_Home    = GuiCtrlCreateButton   ( "Home",       230, 420, 100,  30 )
$GUI_Label_Status   = GUICtrlCreateLabel    ( "Status: ",    10, 495, 600,  30 )
$GUI_Edit_Log       = GUICtrlCreateEdit     ( "Test Log:",  10, 520, 600, 200 )

GUISetState ()       ;Show GUI

$oIE.navigate("http://www.autoitscript.com")

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            $oIE.navigate("http://www.autoitscript.com")
        Case $msg = $GUI_Button_Back
            $oIE.GoBack
        Case $msg = $GUI_Button_Forward
            $oIE.GoForward
    EndSelect
   
  Wend
  GUIDelete ()
Exit

; a few Internet Explorer Event Functions
; ---------------------------------------
Func IEEvent_ProgressChange($Progress,$ProgressMax)
    GUICtrlSetData( $GUI_Progress , ($Progress * 100) / $ProgressMax )
EndFunc

Func IEEvent_StatusTextChange($Text)
    GUICtrlSetData( $GUI_Label_Status, $Text)
    If $Text <> "" then GUICtrlSetData( $GUI_Edit_Log, "IE Status text changed to: " & $Text & @CRLF  , "append" )
EndFunc