[python-win32] Help Needed on Handling Events from a Proprietary COM Object

Darren McElfresh dmcelfresh at yahoo.com
Tue Feb 28 22:26:18 CET 2012


I’ve read through numerous posts on how to get this to work, but I’ve
realized it is time to ask for help.
 
In general I have a COM object that returns an event handler:
    event_source = com_object.newEventSource(
arg_data )
 
I’ve tried establishing the connection points necessary by creating
an event class derived on the sink co-class of this event source:
    class Events(win32com.client.getevents(COM_LIB.CLSID)):
 
I included all of the methods that were mentioned in the generated code
from makepy.  From there I tried to utilize
DispatchWithEvents to connect the listener:
    event_monitor =
win32com.client.DispatchWithEvents( event_source, Events )
 
Everything seems fine at this point, but when I use try to listen
it never seems to fire:
    rc = win32event.WaitForSingleObject( event_monitor.event,
TIME )
 
I’ve even tried (even though I don’t think it is necessary for
single threaded applications):
    pythoncom.PumpWaitingMessages()
 
However that didn’t seem to have any impact either.  No matter what I try – I can’t get my
handlers to fire.  I have sample code on
how to do this in C++, and I have already taken the sample Java code and have
my own version of that working; however I’d prefer to use Python if I can get
it to work.
 
I can provide my code (or the samples), but it is somewhat lengthy
so I was hoping someone would see what I was missing right away?
 
Any ideas would be appreciated.
 
Thanks,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120228/8ef32286/attachment-0001.html>


More information about the python-win32 mailing list