#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Global $GUI_Button_Back, $GUI_Button_Forward,$Command , $Enable
Global Const $CSC_NAVIGATEFORWARD = 0x00000001
Global Const $CSC_NAVIGATEBACK = 0x00000002
Local $oIE, $GUIActiveX
Local $GUI_Button_Home, $GUI_Button_Stop, $msg
$oIE = ObjCreate("Shell.Explorer.2")
GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 600, 360)
$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_Button_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30)
$GUI_Button_Exit = GUICtrlCreateButton("Exit",10, 460, 100, 30)
$GUI_Button_More = GUICtrlCreateButton("Еще кнопка",120, 460, 100, 30)
ControlDisable("","",$GUI_Button_Back)
ControlDisable("","",$GUI_Button_Forward )
GUISetState() ;Show GUI
ObjEvent($oIE, "IEEvent_");, "DWebBrowserEvents") ;создаем обЪект для регистрации событий
$oIE.navigate("http://www.google.ru/")
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
Case $msg = $GUI_Button_Stop
$oIE.Stop
Case $msg = $GUI_Button_Exit
exit
Case $msg = $GUI_Button_More
MsgBox(1,"","Вот еще кнопка")
EndSelect
wend
GUIDelete()
; Функция обработки события _CommandStateChange в браузере
Func IEEvent_CommandStateChange($command, $enable)
Switch $command
Case $CSC_NAVIGATEBACK
If $enable = True Then
ControlEnable("","",$GUI_Button_Back)
Else
ControlDisable("","",$GUI_Button_Back)
EndIf
Case $CSC_NAVIGATEFORWARD
If $enable = True Then
ControlEnable("","",$GUI_Button_Forward)
Else
ControlDisable("","",$GUI_Button_Forward )
EndIf
EndSwitch
EndFunc