[python-win32] Follow-up question

Mark Hammond mhammond at skippinet.com.au
Tue Aug 28 01:54:11 CEST 2007


> Brad Johnson <Brad.Johnson <at> ballardtech.com> writes:
> 
> I have successfully used the PyCom_PyObjectFromIUnknown function to get
> a
> PyIDispatch object from a raw IDispatch pointer.
> 
> My next goal is to get an early bound class instance from that pointer
> (using a
> class generated from makepy).

Just pass the Dispatch wrapper to gencache.EnsureDispatch() - it will run
makepy and turn your object into a Dispatch backed by the makepy file.  Note
however that this relies on the IDispatch pointer providing type-info which
identifies it - if it doesn't then somehow your code needs to know the
typelib ID and jump through some extra hoops.

Cheers,

Mark



More information about the python-win32 mailing list