Sign in to follow this  
Followers 0

"Browser" crashes on Back, Forward buttons

2 posts in this topic

This code is no rocket science, but browser crashes if Back or Forward button is clicked, given that nothing has been navigated to. I found a suggestion by Microsoft, but can't make heads or tails of it, and can't figure out how to implement the suggestion in AutoIt.

#include <GUIConstants.au3>
#include <IE.au3>
; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
; See also:

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
$gui = GUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2, BitOr($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$client = WinGetClientSize($gui)
$GUIActiveX      = GUICtrlCreateObj   ( $oIE,   1, 30 , $client[0], $client[1]-30)

$GUI_Button_Back    = GuiCtrlCreateButton   ("Back",     1, 1, 100,  30)
$GUI_Button_Forward = GuiCtrlCreateButton   ("Forward", 100, 1, 100,  30)
$GUI_Button_Home    = GuiCtrlCreateButton   ("Home",    200, 1, 100,  30)
$GUI_Button_Stop    = GuiCtrlCreateButton   ("Stop",    300, 1, 100,  30)

GUISetState ()    ;Show GUI


While 1

    $msg = GUIGetMsg()
        if $oIE.busy=0 Then
            $title = $oIE.document.title
            WinSetTitle($gui, "", $title)
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $GUI_Button_Home
        Case $msg = $GUI_Button_Back
        Case $msg = $GUI_Button_Forward
        Case $msg = $GUI_Button_Stop

GUIDelete ()


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0