Sign in to follow this  
Followers 0
andpandpudpie

"GUICtrlCreateObj" ActiveX Control In GUI

1 post in this topic

Hi All,

Wasn't sure if this post should go under "ActiveX/COM" or "GUI" forum ...

I have created the following piece of code which works great:-

#-------------------------------------------------------------------------------

#include <IE.au3>

$ie = _IECreate("http://www.xxx-xxx",0,1,1,1)

_IELoadWait($ie)

$form = _IEFormGetObjByName($ie, "login")

$text = _IEFormElementGetObjByName($form, "username")

_IEFormElementSetValue($text, "xxx-xxx")

$text = _IEFormElementGetObjByName($form, "password")

_IEFormElementSetValue($text, "xxx-xxx")

_IEFormSubmit($form,0)

_IELoadWait($ie)

#---------------------------------------------------------------------------------

I have now created myself a GUI with an ActiveX webbrowser control:-

#-------------------------------------------------------------------------------

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <IE.au3>

Local $ie, $GUIActiveX, $msg

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

GUICreate("xxx-xxx", 500, 500, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))

$GUIActiveX = GUICtrlCreateObj($ie, 0, 0, 500, 500)

GUICtrlSetResizing($GUIActiveX, $GUI_DOCKHCENTER)

GUISetState()

$ie.navigate("http://xxx-xxx")

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

GUIDelete()

#---------------------------------------------------------------------------------

I have tried the following to make my original code work with the above GUI but i keep getting errors ... I just can't get it to work:-

#---------------------------------------------------------------------------------

#include <IE.au3>

Local $ie, $GUIActiveX, $msg

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

GUICreate("xxx-xxx", 500, 500, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))

$GUIActiveX = GUICtrlCreateObj($ie, 0, 0, 500, 500)

GUICtrlSetResizing($GUIActiveX, $GUI_DOCKHCENTER)

GUISetState()

$ie.navigate("http://xxx-xxx")

$form = _IEFormGetObjByName($ie, "login")

$text = _IEFormElementGetObjByName($form, "username")

_IEFormElementSetValue($text, "xxx-xxx")

$text = _IEFormElementGetObjByName($form, "password")

_IEFormElementSetValue($text, "xxx-xxx")

_IEFormSubmit($form,0)

_IELoadWait($ie)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

GUIDelete()

#---------------------------------------------------------------------------------

ERROR MESSAGE RECEIVED FROM ABOVE CODE:-

E:\Program Files\AutoIt3\Include\IE.au3 (1111) : ==> Variable must be of type "Object".:

Local $o_col = $o_object.document.forms.item($s_Name)

Local $o_col = $o_object.document^ ERROR

Does anyone know where i am going wrong?

Many Thanks

Regards

:)

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