RealProxy.SupportsInterface(Guid) Метод

Определение

Запрашивает COM-интерфейс с заданным ID.

public:
 virtual IntPtr SupportsInterface(Guid % iid);
public virtual IntPtr SupportsInterface (ref Guid iid);
abstract member SupportsInterface : Guid -> nativeint
override this.SupportsInterface : Guid -> nativeint
Public Overridable Function SupportsInterface (ByRef iid As Guid) As IntPtr

Параметры

iid
Guid

Ссылка на запрашиваемый интерфейс.

Возвращаемое значение

IntPtr

nativeint

Указатель на запрашиваемый интерфейс.

Примеры

[SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)]
IntPtr SupportsInterface( Guid * /*myGuid*/ )
{
   Console::WriteLine( "SupportsInterface method called" );
   
   // Object reference is requested for communication with unmanaged objects
   // in the current process through COM.
   IntPtr myIntPtr = this->GetCOMIUnknown( false );
   
   // Stores an unmanaged proxy of the object.
   this->SetCOMIUnknown( myIntPtr );
   
   // return COM Runtime Wrapper pointer.
   return myIntPtr;
}
public override IntPtr SupportsInterface(ref Guid myGuid)
{
    Console.WriteLine("SupportsInterface method called");
    // Object reference is requested for communication with unmanaged objects
    // in the current process through COM.
    IntPtr myIntPtr = this.GetCOMIUnknown(false);
    // Stores an unmanaged proxy of the object.
    this.SetCOMIUnknown(myIntPtr);
    // return COM Runtime Wrapper pointer.
    return myIntPtr;
}
<SecurityPermission(SecurityAction.LinkDemand, Flags := SecurityPermissionFlag.Infrastructure)> _
Public Overrides Function SupportsInterface(ByRef myGuid As Guid) As IntPtr
   Console.WriteLine("SupportsInterface method called")
   ' Object reference is requested for communication with unmanaged objects
   ' in the current process through COM.
   Dim myIntPtr As IntPtr = Me.GetCOMIUnknown(False)
   ' Stores an unmanaged proxy of the object.
   Me.SetCOMIUnknown(myIntPtr)
   ' return COM Runtime Wrapper pointer.
   Return myIntPtr
End Function 'SupportsInterface

Комментарии

Метод SupportsInterface позволяет текущему экземпляру прокси-сервера реализовать дополнительные COM-интерфейсы от имени объекта сервера, который представляет текущий экземпляр. Текущий метод создает запрошенный интерфейс и возвращает указатель на него. Типы COM-интерфейсов, которые могут быть созданы этим методом, зависят от типа прокси-сервера, который, в свою очередь, может зависеть от типа объекта сервера, который представляет текущий экземпляр прокси-сервера.

Для получения дополнительной информации см. ProxyAttribute.

Применяется к