Partager via


IInterfaceInfo.Source Property

Definition

Gets a value indicating whether the interface is the source — that is, an interface that the client listens to, rather than calls.

public:
 property bool Source { bool get(); };
public:
 property bool Source { bool get(); };
[System.Runtime.InteropServices.DispId(1610743811)]
public bool Source { [System.Runtime.InteropServices.DispId(1610743811)] get; }
[<System.Runtime.InteropServices.DispId(1610743811)>]
[<get: System.Runtime.InteropServices.DispId(1610743811)>]
member this.Source : bool
Public ReadOnly Property Source As Boolean

Property Value

true if the interface is the source; otherwise, false.

Attributes

Examples

// From the Visual C++ Member Variable wizard  

function GenerateActiveXControlClassText(oTypeLib)  
{  
   var strClassText = "";  

   var oInterfaces = oTypeLib.Interfaces;  
   var nCount = oInterfaces.Count;  

   var bGenerate_Array = new Array();  
   var Name_Array = new Array();  
   var Base_Array = new Array();  
   var i;  
   for (i = 0; i < nCount; i++)  
   {  
      var oInterface = oInterfaces.item(i+1);  

      if (oInterface.CoClass != CONTROL_TYPE.text   
         || oInterface.Default == false   
         || oInterface.Source == true)  
         continue;  

      Name_Array[i] = oInterface.Name;  
      Base_Array[i] = oInterface.Base;  
      bGenerate_Array[i] = true;  
   }  
   for (i = 0; i < nCount; i++)  
   {  
      if (oInterface.CoClass != CONTROL_TYPE.text   
         || oInterface.Default == false   
         || oInterface.Source == true)  
         continue;  

      var strBase = Base_Array[i];  
      if(strBase && strBase.length &&   
         strBase!="IDispatch" && strBase!="IUnknown")  
      {  
         for(var j=0; j< nCount; j++)  
         {  
            if(strBase == Name_Array[j])  
            {  
               bGenerate_Array[j] = false;  
               break;  
            }  
         }  
      }  
   }  
   for (i = 0; i <  nCount; i++)  
   {  
      var oInterface = oInterfaces.item(i+1);  
      if(!bGenerate_Array[i])  
      {  
         strClassText += "// Interface: " + Name_Array[i] + " not generated, because it was a base interface for others.\n\n";  
      }  
      else if (oInterface.Type == 2   
               && oInterface.CoClass == CONTROL_TYPE.text   
               && oInterface.Default   
               && !oInterface.Source)  // einterfaceDispinterface  
      {  
         strClassText += "// ";  
         strClassText += Name_Array[i];  
         strClassText += "\r\n\r\n// Functions\r\n//\r\n\r\n";  
         strClassText += GetFuncText(oTypeLib, oInterface, strClassText);  
      }  
   }  
   return strClassText;  
}  

Remarks

A source interface is an interface that communicates to the client, rather than an interface the client calls (for example, by way of connection points in C++). A server calls (or multiplexes the calls if the interface allows several clients), and the client implements the handler.

Only one interface can be marked [source] in a given coclass.

Applies to