johnny loops schrieb:
> Thanks, these references are really helpful, and I think I understand
> a lot more of the path using comtypes.  Continuing with my pseudo code
> example-- this is what I think I should do:
> 
> -run GetModule() on the library, which should create the interface foo

Yes.

> -Create a class implementing foo

Yes.

> -Create object implementing interface foo

Yes.

> -Pass the object to the other com function that will fire callbacks to it
> 
> comtypes.client.GetModule('CLSID that contains foo')
> class myComObjClass(COMObject):
>       _com_interfaces_ = [foo]
> 
>       def foo_OnFunc1(self, this, variable1):
>               do some stuff on callback
>       def foo_OnFunc2(self, this, variable2):
>               do some other stuff
> 
> o=myComObjClass()
> otherDispatchedComObject.FunctionThatNeedsInterface(o, otherInputs)
> 
> What I'm not sure about is the step that creates the object.  Before,
> when I tried using win32com, I thought I had to wrap a server to pass
> it-- this didn't work, so I could have been off the mark here.  Does
> this look right?  Is it really this easy?

Yes, it should work this way.  The COMObject base class takes care of the rest.

Thomas

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to