[python-win32] GetRefTypeOfImplType problem

Marc-Andre Belzile Marc-Andre.Belzile at autodesk.com
Fri Mar 25 23:51:25 CET 2011


Hi,

I'm trying to get the base interface typeinfo with pythoncom.GetRefTypeOfImplType but it's always returning the typeinfo of  the IDispatch interface.

Does the code below seem wrong ?

Thank you for your help.
-mab

def log_base_interface( tlb ):
    n = tlb.GetTypeInfoCount()
    for i in range(n):
        iface_ti = tlb.GetTypeInfo( i )
        iface_attr = iface_ti.GetTypeAttr()

        if iface_attr[5] == pythoncom.TKIND_DISPATCH:
                print '>>>>> Base interfaces for %s' % (iface_ti.GetDocumentation(-1)[0])
                for i in range(iface_attr[8]):
                    flags = iface_ti.GetImplTypeFlags(i)
                    refType = iface_ti.GetRefTypeInfo(iface_ti.GetRefTypeOfImplType(i))
                    refAttr = refType.GetTypeAttr()
                    print refType.GetDocumentation(-1)[0]

output:
>>>>> Base interfaces for SIObject
IDispatch
>>>>> Base interfaces for Application
IDispatch
>>>>> Base interfaces for SIObjectCollection
IDispatch
>>>>> Base interfaces for LightRig
IDispatch
etc...

My interfaces are all defined like this:

[
      uuid(231B4BC1-4F8E-11d4-ACDC-0090275802BF),
      helpstring("LightRig interface"),
      object,           // specifies a COM interface (default is RPC interface)
      local,            // interface to define is not remote
      dual,             // identifies an IDispatch interface that exposes directly through the VTBL
      pointer_default(unique) // this option is only instructing midl that we may have functions with embedded pointers-pointers. Otherwise it is ignored by idl.
]
interface LightRig : Null
{
      // properties
      [propget, id(1), helpstring("property Light")]
      HRESULT Light([out, retval] Light** );
};

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110325/bf9b77ab/attachment.html>


More information about the python-win32 mailing list