[python-win32] newbie problem with DispatchWithEvents
Mark Hammond
mhammond at skippinet.com.au
Tue Apr 4 01:54:16 CEST 2006
> I'm new to python and python-win32.
> Need to use an instance of IE for a little work.
> I'm trying looking at the examples found, but I'm encountering a
> big problem
> to proceed:
> if I use win32com.client.Dispatch, all works fine, I can manipulate the IE
> instance without problems. But I need to catch some events from that
> instance; so I used win32com.client.DispatchWithEvents passing as
> eventClass
> a very simple class that handle only the OnVisible event.
> Every time I use the DispatchWithEvents, the IE instance seems to be
> locked... I can get it visible and I see that isn't all well draw, I can't
> Quit it (must kill the process), it doesn't respond to Navigate
> or any other
> method.
In most cases, you need to be processing a "message loop" for this to work
as you expect. Check out the win32com\demos\eventsApartmentThreaded.py and
eventsFreeThreaded.py (they first appeared build 208, so you may need to
upgrade) for examples of how to achieve this.
Mark
More information about the Python-win32
mailing list