IInterfaceInfo.Source 属性

获取指示界面是否为源的值,即用户只是侦听界面而非调用。

命名空间:  Microsoft.VisualStudio.VsWizard
程序集:  Microsoft.VisualStudio.VsWizard(在 Microsoft.VisualStudio.VsWizard.dll 中)

语法

声明
ReadOnly Property Source As Boolean
bool Source { get; }
property bool Source {
    bool get ();
}
abstract Source : bool with get
function get Source () : boolean

属性值

类型:Boolean
如果接口是源,则为 true;否则为 false。

备注

源是接口进行。客户的接口,而不是 (例如调用的接口 (在 C++ 中,客户通过连接点)。 服务器调用 (或调用多路复用,则接口允许多个客户) 和客户端实现处理程序。

只有一个可标记为接口 [源] 的 coclass。

示例

// 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;
}

.NET Framework 安全性

请参阅

参考

IInterfaceInfo 接口

Microsoft.VisualStudio.VsWizard 命名空间