Passing COM IDispatch from C to PythonCOM

Mark Hammond mhammond at skippinet.com.au
Wed Nov 27 17:29:00 EST 2002


Jon Redgrave wrote:
> I have a C program that has an IDispatch pointer to a COM object.
> I want to run an embedded python script that uses this IDispatch pointer
> (using Mark Hammond's excellent win32all), but do not know how to pass it to
> the script.
> 
> PythonCOM appears to wrap IDispatch's in PyIDispatch object, How do I wrap
> it, or can I somehow pass it another way (as an int??) and wrap it in
> Python?

You need pass the object to:

PYCOM_EXPORT PyObject *PyCom_PyObjectFromIUnknown(IUnknown *punk, REFIID 
riid, BOOL bAddRef = FALSE);


defined in pythoncom.h

Mark.




More information about the Python-list mailing list