Op Englesch liesen Editéieren

Deelen iwwer


RealProxy.GetCOMIUnknown(Boolean) Method

Definition

Requests an unmanaged reference to the object represented by the current proxy instance.

C#
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
C#
[System.Security.SecurityCritical]
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);

Parameters

fIsMarshalled
Boolean

true if the object reference is requested for marshaling to a remote location; false if the object reference is requested for communication with unmanaged objects in the current process through COM.

Returns

IntPtr

A pointer to a COM Callable Wrapper if the object reference is requested for communication with unmanaged objects in the current process through COM, or a pointer to a cached or newly generated IUnknown COM interface if the object reference is requested for marshaling to a remote location.

Attributes

Examples

C#
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;
}

Remarks

If the proxy is requested for marshaling, then an IUnknown interface for the object represented by the current proxy instance is returned. If an IUnknown was previously cached by the SetCOMIUnknown method, then that instance is returned; otherwise, a new instance is returned.

If the proxy is requested not for marshaling but for communication with unmanaged objects in the current process, then a COM Callable Wrapper (CCW), which can be used in the current process for communication through COM, is returned.

Applies to

Produkt Versiounen
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1