private void ScanImplementedTypes(ITypeInfo typeInfo, System.Runtime.InteropServices.ComTypes.TYPEATTR typeAttributes) { for (int i = 0; i < typeAttributes.cImplTypes; i++) { IFixedTypeInfo ppTI = null; try { IntPtr ptr; IFixedTypeInfo info2 = (IFixedTypeInfo)typeInfo; info2.GetRefTypeOfImplType(i, out ptr); info2.GetRefTypeInfo(ptr, out ppTI); this.AnalyzeTypeInfo((ITypeInfo)ppTI); } finally { if (ppTI != null) { this.marshalReleaseComObject(ppTI); } } } }
/// <summary> /// For a given type, analyze recursively all the types implemented by it. /// </summary> /// <param name="typeInfo"></param> /// <param name="typeAttributes"></param> private void ScanImplementedTypes(ITypeInfo typeInfo, TYPEATTR typeAttributes) { for (int implTypeIndex = 0; implTypeIndex < typeAttributes.cImplTypes; implTypeIndex++) { IFixedTypeInfo implementedType = null; try { IntPtr hRef; IFixedTypeInfo fixedTypeInfo = (IFixedTypeInfo)typeInfo; fixedTypeInfo.GetRefTypeOfImplType(implTypeIndex, out hRef); fixedTypeInfo.GetRefTypeInfo(hRef, out implementedType); AnalyzeTypeInfo((ITypeInfo)implementedType); } finally { if (implementedType != null) { _marshalReleaseComObject(implementedType); } } } }