RealProxy.GetCOMIUnknown(Boolean) Methode

Definitie

Hiermee wordt een niet-beheerde verwijzing naar het object aangevraagd dat wordt vertegenwoordigd door het huidige proxy-exemplaar.

public:
 virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
[System.Security.SecurityCritical]
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
abstract member GetCOMIUnknown : bool -> nativeint
override this.GetCOMIUnknown : bool -> nativeint
[<System.Security.SecurityCritical>]
abstract member GetCOMIUnknown : bool -> nativeint
override this.GetCOMIUnknown : bool -> nativeint
Public Overridable Function GetCOMIUnknown (fIsMarshalled As Boolean) As IntPtr

Parameters

fIsMarshalled
Boolean

true indien de objectverwijzing wordt aangevraagd voor marshaling naar een externe locatie; false als de objectverwijzing wordt aangevraagd voor communicatie met onbeheerde objecten in het huidige proces via COM.

Retouren

IntPtr

nativeint

Een aanwijzer naar een COM-aanroepbare wrapper als de objectverwijzing wordt aangevraagd voor communicatie met onbeheerde objecten in het huidige proces via COM, of een aanwijzer naar een in de cache geplaatste of nieuw gegenereerde IUnknown COM-interface als de objectverwijzing wordt aangevraagd voor marshaling naar een externe locatie.

Kenmerken

Voorbeelden

[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

Opmerkingen

Als de proxy wordt aangevraagd voor marshaling, wordt er een IUnknown interface voor het object geretourneerd dat wordt vertegenwoordigd door het huidige proxy-exemplaar. Als een IUnknown eerder in de cache opgeslagen is door de SetCOMIUnknown methode, wordt dat exemplaar geretourneerd. Anders wordt er een nieuw exemplaar geretourneerd.

Als de proxy niet wordt aangevraagd voor marshaling, maar voor communicatie met onbeheerde objecten in het huidige proces, wordt een COM Callable Wrapper (CCW), die kan worden gebruikt in het huidige proces voor communicatie via COM, geretourneerd.

Van toepassing op