IInterfaceInfo.Source - свойство
Gets a value indicating whether the interface is the source — that is, an interface that the client listens to, rather than calls.
Пространство имен: Microsoft.VisualStudio.VsWizard
Сборка: Microsoft.VisualStudio.VsWizard (в Microsoft.VisualStudio.VsWizard.dll)
Синтаксис
'Декларация
ReadOnly Property Source As Boolean
'Применение
Dim instance As IInterfaceInfo
Dim value As Boolean
value = instance.Source
bool Source { get; }
property bool Source {
bool get ();
}
function get Source () : boolean
Значение свойства
Тип: System.Boolean
true if the interface is the source; otherwise, false.
Заметки
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.
Примеры
// 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;
}
Разрешения
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.