Function Reference


GUICtrlCreateObj

Creates an ActiveX control in the GUI.

GUICtrlCreateObj ( ObjectVar, left, top [, width [, height]] )

Parameters

ObjectVar A variable pointing to a previously opened object
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width [optional] The width of the control (default is the previously used width).
height [optional] The height of the control (default is the previously used height).

Return Value

Success: the identifier (controlID) of the new control.
Failure: 0.

Remarks

This function attempts to embed an 'ActiveX Control' or a 'Document Object' inside the GUI.
Not every control can be embedded. They must at least support an 'IDispatch' interface.

See the Obj/COM Reference for more information about Objects.

'Document Objects' will only be visible if the Windows style $WS_CLIPCHILDREN has been used in GUICreate().

The GUI functions GUICtrlRead() and GUICtrlSet have no effect on this control. The object can only be controlled using 'methods' or 'properties' on the $ObjectVar.

Related

IsObj, ObjCreate, ObjEvent, ObjGet

Example

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

Example()

; 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 $idButton_Back, $idButton_Forward
    Local $idButton_Home, $idButton_Stop, $iMsg

    Local $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))
    GUICtrlCreateObj($oIE, 10, 40, 600, 360)
    $idButton_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
    $idButton_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
    $idButton_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
    $idButton_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30)

    GUISetState(@SW_SHOW) ;Show GUI

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

    ; Loop until the user exits.
    While 1
        $iMsg = GUIGetMsg()

        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $iMsg = $idButton_Home
                $oIE.navigate("http://www.autoitscript.com")
            Case $iMsg = $idButton_Back
                $oIE.GoBack
            Case $iMsg = $idButton_Forward
                $oIE.GoForward
            Case $iMsg = $idButton_Stop
                $oIE.Stop
        EndSelect

    WEnd

    GUIDelete()
EndFunc   ;==>Example