Export (0) Print
Expand All

RealProxy.GetCOMIUnknown Method

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

Namespace: System.Runtime.Remoting.Proxies
Assembly: mscorlib (in mscorlib.dll)

public virtual IntPtr GetCOMIUnknown (
	bool fIsMarshalled
)
public IntPtr GetCOMIUnknown (
	boolean fIsMarshalled
)
public function GetCOMIUnknown (
	fIsMarshalled : boolean
) : IntPtr
Not applicable.

Parameters

fIsMarshalled

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.

Return Value

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.

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.

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
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;
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft