Convert a raw pointer to IDispatch

Thomas Heller theller at python.net
Thu Feb 17 13:22:16 EST 2005


Roger That <fabsk+news at free.fr> writes:

> Hi,
>
> I am trying to use the function "CreateStreamOnHGlobal" from python
> code (I need to pass an IStream object to MSXML, like I do in C++
> code).
>
> I was able to retrieve a pointer on the IStream object in this way:
>
> from ctypes import *
>
> stream = c_int()
> windll.ole32.CreateStreamOnHGlobal(c_long(0), c_long(1), byref(stream))
> print "%x"%stream.value
>
> The problem is that I would like to attach this pointer to a python
> IDispatch object (in Python only, not using a C++ DLL to do the
> stuff). Do you know a way to do it ?

What do you want to do with this pointer? Pass it to a function called
via ctypes?

Thomas



More information about the Python-list mailing list