RealProxy.SupportsInterface(Guid) Metoda

Definicja

Żąda interfejsu COM o określonym identyfikatorze.

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

Parametry

iid
Guid

Odwołanie do żądanego interfejsu.

Zwraca

IntPtr

nativeint

Wskaźnik do żądanego interfejsu.

Przykłady

[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

Uwagi

Metoda SupportsInterface umożliwia bieżącemu wystąpieniu serwera proxy zaimplementowanie dodatkowych interfejsów COM w imieniu obiektu serwera reprezentowanego przez bieżące wystąpienie. Bieżąca metoda generuje żądany interfejs i zwraca do niego wskaźnik. Typy interfejsów COM, które mogą być generowane przez tę metodę, zależą od typu serwera proxy, który z kolei może zależeć od typu obiektu serwera reprezentowanego przez bieżące wystąpienie serwera proxy.

Aby uzyskać więcej informacji, zobacz ProxyAttribute.

Dotyczy