Rediger

Del via


ComWrappers.GetOrCreateComInterfaceForObject Method

Definition

Creates a COM representation of the supplied object that can be passed to a non-managed environment.

public:
 IntPtr GetOrCreateComInterfaceForObject(System::Object ^ instance, System::Runtime::InteropServices::CreateComInterfaceFlags flags);
public IntPtr GetOrCreateComInterfaceForObject (object instance, System.Runtime.InteropServices.CreateComInterfaceFlags flags);
member this.GetOrCreateComInterfaceForObject : obj * System.Runtime.InteropServices.CreateComInterfaceFlags -> nativeint
Public Function GetOrCreateComInterfaceForObject (instance As Object, flags As CreateComInterfaceFlags) As IntPtr

Parameters

instance
Object

The managed object to expose outside the .NET runtime.

flags
CreateComInterfaceFlags

Flags used to configure the generated interface.

Returns

IntPtr

nativeint

The generated COM interface, as a pointer to the IUnknown interface implementation, that can be passed outside the .NET runtime.

Remarks

If a COM representation was previously created for the specified instance using this ComWrappers instance, the previously created COM interface will be returned. If not, a new one will be created.

Applies to