How to receive MSHTML events?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to receive MSHTML events?

Stefan Matthias Aust
Hi,

according to Microsoft's MSHTML documentation, it is possible to connect an
event sink to any HTML DOM object. I tried the following, but couldn't make
it work. Any ideas what's wrong are appreciated.

This is, what I tried. Setup a IWebBrowser2 object in the control browser,
self is the instance. Now evaluate:

    "create an empty HTML DOM..."
    self navigate: 'about:blank'.

    "set a webpage, the javascript-stuff is needed to disable the default
behavior"
    self document body innerHTML: '<a id="X" href="javascript:void(0)">Test,
test, test</a>'.

    "get the A element"
    e := self document all item: 'X'.

    "get the element's event source type info"
    ti := (e coclassTypeInfoIfNone: [^nil]) defaultSourceInterface.

    "create an event sink"
    sink := AXEventSink target: self sourceTypeInfo: ti.
    sink isTracingEnabled: true.

    "connect it"
    sink connect: e

But I don't get any event from that element. I added a "Transcript show"
message to AXEventSink#invokeId:flags:withArguments: to test this.

bye
--
Stefan Matthias Aust  //  Truth Until Paradox