RealProxy.SupportsInterface(Guid) Méthode

Définition

Demande une interface COM avec l'ID spécifié.

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

Paramètres

iid
Guid

Référence à l'interface demandée.

Retours

IntPtr

nativeint

Pointeur vers l'interface demandée.

Exemples

[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

Remarques

La SupportsInterface méthode permet au proxy actuel instance d’implémenter des interfaces COM supplémentaires pour le compte de l’objet serveur que le instance actuel représente. La méthode actuelle génère l’interface demandée et retourne un pointeur vers celle-ci. Les types d’interfaces COM qui peuvent être générées par cette méthode dépendent du type de proxy, qui à son tour peut dépendre du type de l’objet serveur que le proxy actuel instance représente.

Pour plus d'informations, consultez ProxyAttribute.

S’applique à