By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

Convert PyIDispatch object to struct IDispatch*

P: n/a
I am trying to use ctypes to call dll functions. One of the functions
requires argument "struct IDispatch* ". I do have a PyIDispatch object
in python. How can I convert this "PyIDispatch object" to "struct
IDispatch* "?

Thanks in advance.
Apr 10 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <hu*********@gmail.com>
escribió:
I am trying to use ctypes to call dll functions. One of the functions
requires argument "struct IDispatch* ". I do have a PyIDispatch object
in python. How can I convert this "PyIDispatch object" to "struct
IDispatch* "?
I think a PyIDispatch object is an IDispatch* itself.
But you'll get better answers from the python-win32 list:
http://mail.python.org/mailman/listinfo/python-win32

--
Gabriel Genellina

Apr 11 '08 #2

P: n/a
On Apr 11, 12:15 am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <huayang....@gmail.com>
escribió:
I am trying to use ctypes to call dll functions. One of the functions
requires argument "struct IDispatch* ". I do have a PyIDispatch object
in python. How can I convert this "PyIDispatch object" to "struct
IDispatch* "?

I think a PyIDispatch object is an IDispatch* itself.
But you'll get better answers from the python-win32 list:http://mail.python.org/mailman/listinfo/python-win32

--
Gabriel Genellina
Thanks for the info.

To call a dll function, it needs a C style IDispatch*. PyIDispatch is
a python wrapped one. I found a reference from:

http://svn.python.org/projects/ctype...com_interop.py

which shows how to convert C style to python style. Unfortunately i
need the reversed version.

I will post the question to python-win32.
Apr 11 '08 #3

P: n/a
Huayang Xia wrote:
On Apr 11, 12:15 am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
>En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <huayang....@gmail.com>
escribió:
>>I am trying to use ctypes to call dll functions. One of the functions
requires argument "struct IDispatch* ". I do have a PyIDispatch object
in python. How can I convert this "PyIDispatch object" to "struct
IDispatch* "?
I think a PyIDispatch object is an IDispatch* itself.
But you'll get better answers from the python-win32 list:http://mail.python.org/mailman/listinfo/python-win32

--
Gabriel Genellina

Thanks for the info.

To call a dll function, it needs a C style IDispatch*. PyIDispatch is
a python wrapped one. I found a reference from:

http://svn.python.org/projects/ctype...com_interop.py

which shows how to convert C style to python style. Unfortunately i
need the reversed version.

I will post the question to python-win32.
I've had a quick look at the PyIDispatch source and I can't see any obvious
way in which the underlying IDispatch is exposed. May have missed something,
but it's possible that there's not way out.

TJG
Apr 11 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.