[python-win32] win32com: Connecting event class after object creation
Celvin
read.beyond.data at gmx.net
Tue Nov 3 11:03:01 CET 2009
Hi,
I'm currently using win32com to access COM objects created via .NET's
COM interop, which is working surprisingly well.
Currently, I stumpled upon a minor problem, though: I would like to
connect a class implementing several event handlers to an COM object
returned by a method call of another COM object.
What I'm doing is basically this:
class event_class:
def event_handler1(self):
pass
class another_event_class:
def foobar(self):
pass
obj = win32com.client.DispatchWithEvents("{...}", event_class)
new_obj = obj.CreateObject()
# here i would like another_event_class to handle events of new_obj
Do I have to use new_obj._oleobj_'s QueryInterface to obtain an
interface pointer to IID_IConnectionPointContainer and attach the
event handler myself, or is there any other, more comfortable way
using win32com?
Any pointers are appreciated,
Celvin
More information about the python-win32
mailing list