pschneider

Query Interface for ObjectClassDescription

Discussion created by pschneider on May 17, 2010
Latest reply on May 18, 2010 by pschneider
I've created a loop to cycle through the relationships of a feature class, then add an event listener on each of the destination tables.  The loop works fine, however I would like to remove (or in other words, not add) the listener from the related annotation classes (feature-linked).  I am trying to QI on the destination class to get its description, but getting nothing.  Attached is the part of the code that I need to modify:

pFeatureClass = pFeatureLayer.FeatureClass
'Get the realtionships wherein the FC is the origin
pEnumRelationshipClass = pFeatureClass.RelationshipClasses(esriRelRole.esriRelRoleOrigin)
pRelationshipClass = pEnumRelationshipClass.Next
'Loop through the relationship classes
Do Until pRelationshipClass Is Nothing
   Dim pDestinationClass As IObjectClass
   Dim pOCDesc As IObjectClassDescription
   Dim pFCDesc As IFeatureClassDescription
   pDestinationClass = pRelationshipClass.DestinationClass

   '*****Here's where I'm having QI trouble in determining feature type
   pOCDesc = pDestinationClass
   pFCDesc = pOCDesc

   If Not pFCDesc.FeatureType = esriFeatureType.esriFTAnnotation Then
       'Initiate a listener on each of the new relationships
       Dim Listener As DestinationClassEventListener = New DestinationClassEventListener(pDestinationClass, pRelationshipClass, Trigger)
       End If

    pRelationshipClass = pEnumRelationshipClass.Next
Loop

What am I doing wrong?  Is there a better, more efficient way to single out annotation feature classes?

Outcomes