Jump to content

_IECreateEmbedded() + $oIE.document.write + ObjEvent


Recommended Posts

Hello !

I'm having some problems with _IECreateEmbedded() + $oIE.document.write + ObjEvent

Here's my code :

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

Local $oIE = _IECreateEmbedded()

$hGUI = GUICreate("test", 220, 150, (@DesktopWidth - 720) / 2, (@DesktopHeight - 650) / 2)

GUISetState(@SW_SHOW, $hGUI)
GUICtrlCreateObj($oIE, 0, 0, 220, 150)

$oIE.navigate("about:blank")
$oIE.document.write("<html><head></head>" & _
"<body style='border:0;margin:0px'><button id='macro2'>MACRO 2</button>" & _
"<br>lorem ipsum<br><br>lorem ipsum<br><br>lorem ipsum<br><br>lorem ipsum<br><br>lorem ipsum<br></body></html>")
$oIE.refresh
$oIE.document.body.scroll = "no"

$oB2 = _IEGetObjByID($oIE, "macro2")

ConsoleWrite(ObjName($oB2) & @CRLF)
ConsoleWrite(ObjName($oB2, 4) & @CRLF) ; File with Interface defs
ConsoleWrite(ObjName($oB2, 6) & @CRLF) ; CLSID of the object's coclass

ObjEvent($oB2, "_MY_EVENT_HANDLER_")

Func _MY_EVENT_HANDLER_onclick($oEvtObj)
    ConsoleWrite("!!!!!CLICKED THE BUTTON" & @CRLF)
    MsgBox(4096, "Yay John!", "You clicked the button.")
EndFunc

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

When i click on the "MACRO 2" button there is nothing happening and i cant' figure why :(

I need to use $oIE.document.write because I need don't want to have a browser scroll.

Thanks a lot for your help !

 

Link to post
Share on other sites

Hi mikell,

Thank you for your answer but it's not working either.

If I do :

ObjEvent($oIE.document, "_MY_EVENT_HANDLER_")

That's working but obviously the all page is answering to the _onclick event and i want just the button.

ObjEvent($oIE.document.getElementById("macro2"), "_MY_EVENT_HANDLER_")

That's not working and i don't know why :(

Thank you for your help !

 

Link to post
Share on other sites

Hi mikell,

Thank you for your answer but it's not working either.

If I do :

ObjEvent($oIE.document, "_MY_EVENT_HANDLER_")

That's working but obviously the all page is answering to the _onclick event and i want just the button.

ObjEvent($oIE.document.getElementById("macro2"), "_MY_EVENT_HANDLER_")

That's not working and i don't know why :(

Thank you for your help !

 

ucakf.png Is that what should happen?

Link to post
Share on other sites

Thank a lot for your answer.

I'm under Win 8.1 + 3.3.12.0 build.

When i doing "Go" (F5) (SciTE 3.4.4) from the menu it's not working. I've checked with the .exe and it's working fine !

I've update to SciTE 3.4.5 and no change with Go or F5. i'm relief that the exe is working, but it's normal to have this difference ?

Thank you again,

 

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...