Beispiel #1
0
        private void AddCoClassMembers(SortedList members)
        {
            int implCount = ComInterop.GetImplTypeCount(m_typeInfo.ComType);

            for (int index = 0; index < implCount; ++index)
            {
                IMPLTYPEFLAGS implTypeFlags;
                m_typeInfo.ComType.GetImplTypeFlags(index, out implTypeFlags);

                if ((implTypeFlags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FDEFAULT) == IMPLTYPEFLAGS.IMPLTYPEFLAG_FDEFAULT)
                {
                    // This is a default interface - gets the corresponding ComTypeBrowserInfo object.

                    int href;
                    m_typeInfo.ComType.GetRefTypeOfImplType(index, out href);

                    ITypeInfo refTypeInfo;
                    m_typeInfo.ComType.GetRefTypeInfo(href, out refTypeInfo);
                    Debug.Assert(refTypeInfo != null, "refTypeInfo != null");

                    // Check if this interface is an event source.

                    bool isEventSource = ((implTypeFlags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FSOURCE) == IMPLTYPEFLAGS.IMPLTYPEFLAG_FSOURCE);

                    // Add each member of the base interface to our members collection.

                    ComTypeBrowserInfo baseType = Manager.GetTypeInfo(refTypeInfo);

                    AddTypeMembersRecursive(baseType, members, isEventSource);
                }
            }
        }
Beispiel #2
0
        private SortedList GetBaseTypes()
        {
            Debug.Assert(m_typeInfo != null, "m_typeInfo != null");

            SortedList baseTypes = new SortedList();

            // Add the implemented types.

            int implCount = ComInterop.GetImplTypeCount(m_typeInfo.ComType);

            for (int index = 0; index < implCount; ++index)
            {
                int href;
                m_typeInfo.ComType.GetRefTypeOfImplType(index, out href);

                ITypeInfo refTypeInfo;
                m_typeInfo.ComType.GetRefTypeInfo(href, out refTypeInfo);
                Debug.Assert(refTypeInfo != null, "refTypeInfo != null");

                string name = Marshal.GetTypeInfoName(refTypeInfo);

                // Do not display IUnknown or IDispatch.

                if (!(name == "IUnknown" || name == "IDispatch"))
                {
                    baseTypes.Add(Manager.GetTypeInfo(refTypeInfo), null);
                }
                else
                {
                    Marshal.ReleaseComObject(refTypeInfo);
                }
            }

            return(baseTypes);
        }