Re: [python-win32] win32com: Connecting event class after object creation
by Mark Hammond other posts by this author
Nov 4 2009 2:01AM messages near this date
[python-win32] win32com: Connecting event class after object creation
|
[python-win32] multiprocessing pickle problem in win32
On 3/11/2009 9:03 PM, Celvin wrote:
>
> 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?
If you are lucky, you can pass the new object (instead of a string) to
DispatchWithEvents...
(If you are unlucky, let me know and I'll do what I can to make you lucky :)
Cheers,
Mark
_______________________________________________
python-win32 mailing list
python-win32@[...].org
http://mail.python.org/mailman/listinfo/python-win32
Thread:
Celvin
Mark Hammond
|