[python-win32] Casting to interface from different typelib?

Mark Hammond skippy.hammond at gmail.com
Fri Jan 9 23:49:03 CET 2009


On 10/01/2009 12:27 AM, Ben Gordon wrote:
Try something like:

> #Now, the "cast"
> mod = gencache.GetModuleForTypelib(typelibB_CLSID,0x0,1,0)
> pB = mod.InterfaceB(pA)

 > pB = mod.InterfaceB(pA.QueryInterface(IID_B, pythoncom.IID_IDispatch))

 > "CastTo" fails because "The interface does not
> appear in the same library as the object."

It might also be worth seeing if we can fix that somehow - eg, maybe an 
optional param allowing the interface and the object itself to be in 
those different typelibs.

Cheers,

Mark


More information about the python-win32 mailing list