Passing COM IDispatch from C to PythonCOM 
Author Message
 Passing COM IDispatch from C to PythonCOM

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?

Many thanks for your help

[email address contains bogus underscore]



Mon, 16 May 2005 03:55:19 GMT  
 Passing COM IDispatch from C to PythonCOM

Quote:
> 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?

> Many thanks for your help

Well, you could use win32com.server.util.wrap(), I suppose?

regards
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Previous .sig file retired to                    www.homeforoldsigs.com
-----------------------------------------------------------------------



Mon, 16 May 2005 04:52:41 GMT  
 Passing COM IDispatch from C to PythonCOM

Quote:

> 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.



Mon, 16 May 2005 06:29:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing IDispatch from VBScript to VI Server

2. How to pass a IDispatch parameter to activex dll

3. How to pass a IDispatch parameter to activex dll

4. COM: Returning IDispatch or NULL

5. Custom COM interfaces with PythonCOM

6. pythoncom: STA python COM server randomly does not receive event from other objects : deadlock

7. PythonCOM: Finding a COM ProgID name?

8. pythonwin using COM import pythoncom error

9. pythoncom.Missing vs. pythoncom.Empty

10. NO PYTHON: http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html

11. to CS: or not to CS: in F-PC assembler

12. Need Help Passing Safe Array to COM Object

 

 
Powered by phpBB® Forum Software