win32com and events

Gillou nospam at bigfoot.com
Mon Dec 9 10:15:19 EST 2002


Use DispatchWithEvents rather than Dispatch

from win32com.client import *
print DispatchWithEvents.__doc__

You need to make your helper class which methods (with same names as events)
handle the events.

Didn't try with IE but used that approach successfully to handle events when
parsing with MSXML.

HTH

--Gilles

"Andreas Ulbrich" <the.ulbi at gmx.net> a écrit dans le message de news:
ast5ur$q5h$1 at mamenchi.zrz.TU-Berlin.DE...
> I try to script an instance of the internet exploder via win32com. I
> have problems getting events to work:
>
> ie = win32com.client.Dispatch("InternetExplorer.Application")
> ie.Navigate(<url that points to a document, which \
> contains a button called 'hitme'>)
> button = ie.document.getElementById('hitme')
>
> # button is a IHTMLElement3
> # I'm interested in events say onclick
> button.onclick = <what do i have to assign here?>
>
> The docs for IHTMLElement3 say that onclick must hold a dispatch VARIANT
> with a default method. How do create such an object, especially with a
> default method?
>





More information about the Python-list mailing list