Jump to content

Trigger a Function when HTML button is clicked inside embedded IE


Go to solution Solved by musahi0128,

Recommended Posts

Hello,

I'm trying to trigger a function when html button is clicked. The page is embedded inside a GUI.

So far I have this code. I expect when I click on the button it trigger the IEEvent_onclick() and show the MsgBox. But when I click on the button it does nothing.

#include <GUIConstantsEx.au3>
#include <IE.au3>

$Form1 = GUICreate("HTML Button Test",600,600,-1,-1)
$oIE = _IECreateEmbedded()
$oIE_ctrl = GUICtrlCreateObj($oIE,16,16,568,568)
_IENavigate($oIE, "about:blank")
_IEDocWriteHTML($oIE, "<html><head></head><body><input type=""button"" value=""Click me!"" id=""Button1"" style=""width:128;height:128""/></body></html>")
_IEAction($oIE, "refresh")
$oMyButton = _IEGetObjById($oIE, "Button1")
$oEvtMyButton = ObjEvent($oMyButton, "IEEvent_")
GUISetState(@SW_SHOW,$Form1)

Func IEEvent_onclick(); I expect this function to be triggered when the "Click me!" button is clicked
    MsgBox(0, "HTML Button Test", "Hello world! It works!!!")
EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Will be cool if this works because I find it easier to create a frontend using html.

Thanks!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...