4.8.4 Enumerating All Nonsource Interfaces in a Coclass

This example illustrates the identification of all coclasses in an automation server type library, and the interfaces implemented by the coclasses.

 INPUT: Reference to the ITypeLib server corresponding to the Automation Server
 COMMENT See example in Section 4.8.1 for getting ITypeLib pointer
  
 CALL ITypeLib::GetTypeInfoCount and OBTAIN pcTInfo
 COMMENT see Section 3.11.4.1 for information on pcTInfo
 FOR X = 0 to pctInfo -1
     CALL ITypeLib::GetTypeInfoType with X and OBTAIN pTKind
     COMMENT See Section 3.11.4.3 for more information on pTKind    
     IF pTKind = TYPEKIND::TKIND_COCLASS THEN
         CALL ITypeLib::GetDocumentation(X, 1, &BstrName, NULL, NULL, NULL)
         PRINT Name of the CoClass is BstrName
         CALL ITypeLib::GetTypeInfo with X and OBTAIN ITypeInfo pointer
         CALL ITypeInfo::GetTypeAttr and OBTAIN TYPEATTR pointer
  
         FOR Y = 0 to TYPEATTR::cImplTypes -1
             ITypeInfo::GetRefTypeOfImplType with Y and OBTAIN HREFTYPE
             COMMENT HREFTYPE is a handle to the implemented interface
             ITypeInfo::GetRefTypeInfo with HREFTYPE and OBTAIN pInterfaceTypeInfo
             COMMENT pInterfaceTypeInfo is a ITypeInfo pointer for interface implemented
                     by this CoClass
             CALL pInterfaceTypeInfo::GetDocumentation(MEMBERID_NIL, 1, &BstrName, NULL,
                  NULL, NULL)
             PRINT Interface implemented is BstrName
         END FOR 
  
     END IF
 END FOR