How to receive events (eg. user mouse clicks) from IE

cal_2pac at yahoo.com cal_2pac at yahoo.com
Thu May 19 00:20:11 EDT 2005


I am trying to trap events from internet explorer eg. when user clicks
on an html link - I need to get notified for that event.

After looking through the newgroups / internet and reading through
various sections in programming python on win32 - I understand that
this can be done using DispatchWithEvents.
I have also referred to discussions on comp.lang.python
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/a3c502d06412a5f8/0ee3083e71316da7?q=dispatchwithevents&rnum=43#0ee3083e71316da7

and

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/1da0668794851296/5bcec1fda216c598?q=dispatchwithevents&rnum=19#5bcec1fda216c598

So far - none of the newgroups postings report that IE events were
trapped successfully (at least I could not find any). However, there is
enough evidence that it can be done.
My problems at the moment:
a) The examples use early binding. However, I cannot get Python makepy
to generate the code to force makepy process at run time - since COM
makepy utility that I invoke from python win 32 does not have any entry
for internet explorer.
I tried to find the CLSID for IE 3050F613-98B5-11CF-BB82-00AA00BDCE0B
but I get an exception
b) Also one of the examples suggest that following code should work

> mod = EnsureModule(...)

> class MyEvents(mod.IDocumentEvents):
>    # your methods here....

> handler = MyEvents(ie.document)

> # handler should start recieving events.

however, what CLSID is to be used in EnsureModule... . I tried with a
few but I always get the error 'NoneType' object has no attribute
'IDocumentEvents'


An example that 'works' will be very useful




More information about the Python-list mailing list