Share via


RealProxy.SupportsInterface(Guid) Methode

Definition

Fordert eine COM-Schnittstelle mit der angegebenen ID an.

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

Parameter

iid
Guid

Ein Verweis auf die angeforderte Schnittstelle.

Gibt zurück

IntPtr

nativeint

Ein Zeiger auf die angeforderte Schnittstelle.

Beispiele

[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

Hinweise

Die SupportsInterface -Methode ermöglicht es dem aktuellen Proxy instance zusätzliche COM-Schnittstellen im Namen des Serverobjekts zu implementieren, das der aktuelle instance darstellt. Die aktuelle Methode generiert die angeforderte Schnittstelle und gibt einen Zeiger darauf zurück. Die Typen von COM-Schnittstellen, die von dieser Methode generiert werden können, hängen vom Proxytyp ab, der wiederum vom Typ des Serverobjekts abhängt, das der aktuelle Proxy instance darstellt.

Weitere Informationen finden Sie unter ProxyAttribute.

Gilt für: