Bagikan melalui


RealProxy.SupportsInterface(Guid) Metode

Definisi

Meminta antarmuka COM dengan ID yang ditentukan.

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

Referensi ke antarmuka yang diminta.

Mengembalikan

IntPtr

nativeint

Penunjuk ke antarmuka yang diminta.

Contoh

[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

Keterangan

Metode ini SupportsInterface memungkinkan instans proksi saat ini untuk mengimplementasikan antarmuka COM tambahan atas nama objek server yang diwakili instans saat ini. Metode saat ini menghasilkan antarmuka yang diminta dan mengembalikan penunjuk ke antarmuka tersebut. Jenis antarmuka COM yang dapat dihasilkan oleh metode ini bergantung pada jenis proksi, yang pada gilirannya mungkin bergantung pada jenis objek server yang diwakili instans proksi saat ini.

Untuk informasi selengkapnya, lihat ProxyAttribute.

Berlaku untuk