Jump to content
Sign in to follow this  

Get window size?

Recommended Posts


I'm trying to get the IE control to scale along with the size of the window:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)


; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
    Local $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward
    Local $GUI_Button_Home, $GUI_Button_Stop, $msg
    $oIE = ObjCreate("Shell.Explorer.2")

    ; Create a simple GUI for our output
    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)

    GUISetState()       ;Show GUI


    ; Waiting for user to close the window
    While 1
        $msg = GUIGetMsg()

            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

EndFunc   ;==>Example

How can I make this possible?

Also I noticed with IE8 that it leaves hanging iexplore.exe processes, how can I make them close properly?

Thank you in advance,


Share this post

Link to post
Share on other sites

Like this?

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

There are other modes. See help file.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

Awesome, just what I needed! Thanks!

I still have problems with the orphaned processes it leaves behind, does anyone know how to fix these?

Much obliged,


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...