Thomas, thanks for your help. Everything seemed to work except when I
needed to pass my com object to another com function to receive
callbacks
> > o=myComObjClass()
> > otherDispatchedComObject.FunctionThatNeedsInterface(o, otherInputs)
The other dispatched com object was created using win32com, and other
functions of it work fine. However, this specific function needs to
be called with a com object implementing the interface as one of the
inputs, and then its functions will be called as callbacks. The error
I get when I pass o to this function is
ValueError: argument is not a COM object
Do you have any suggestions? Thanks again for your help
On 12/7/06, Thomas Heller <[EMAIL PROTECTED]> wrote:
> 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
> [email protected]
> http://mail.python.org/mailman/listinfo/python-win32
>
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32