Редагувати

Поділитися через


ComWrappers.GetOrRegisterObjectForComInstance Method

Definition

Overloads

GetOrRegisterObjectForComInstance(IntPtr, CreateObjectFlags, Object)

Gets the currently registered managed object or uses the supplied managed object and registers it.

GetOrRegisterObjectForComInstance(IntPtr, CreateObjectFlags, Object, IntPtr)

Get the currently registered managed object or uses the supplied managed object and registers it.

GetOrRegisterObjectForComInstance(IntPtr, CreateObjectFlags, Object)

Source:
ComWrappers.cs
Source:
ComWrappers.cs
Source:
ComWrappers.cs

Gets the currently registered managed object or uses the supplied managed object and registers it.

public:
 System::Object ^ GetOrRegisterObjectForComInstance(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags, System::Object ^ wrapper);
public object GetOrRegisterObjectForComInstance (IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags, object wrapper);
member this.GetOrRegisterObjectForComInstance : nativeint * System.Runtime.InteropServices.CreateObjectFlags * obj -> obj
Public Function GetOrRegisterObjectForComInstance (externalComObject As IntPtr, flags As CreateObjectFlags, wrapper As Object) As Object

Parameters

externalComObject
IntPtr

nativeint

Object to import for usage into the .NET runtime.

flags
CreateObjectFlags

Flags used to describe the external object.

wrapper
Object

The object to use as the wrapper for the external object.

Returns

A managed object associated with the supplied external COM object.

Exceptions

The wrapper instance is already associated with an external object.

Remarks

If the wrapper instance already has an associated external object a NotSupportedException will be thrown.

Applies to

GetOrRegisterObjectForComInstance(IntPtr, CreateObjectFlags, Object, IntPtr)

Source:
ComWrappers.cs
Source:
ComWrappers.cs
Source:
ComWrappers.cs

Get the currently registered managed object or uses the supplied managed object and registers it.

public:
 System::Object ^ GetOrRegisterObjectForComInstance(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags, System::Object ^ wrapper, IntPtr inner);
public object GetOrRegisterObjectForComInstance (IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags, object wrapper, IntPtr inner);
member this.GetOrRegisterObjectForComInstance : nativeint * System.Runtime.InteropServices.CreateObjectFlags * obj * nativeint -> obj
Public Function GetOrRegisterObjectForComInstance (externalComObject As IntPtr, flags As CreateObjectFlags, wrapper As Object, inner As IntPtr) As Object

Parameters

externalComObject
IntPtr

nativeint

Object to import for usage into the .NET runtime.

flags
CreateObjectFlags

Flags used to describe the external object.

wrapper
Object

The Object to be used as the wrapper for the external object

inner
IntPtr

nativeint

Inner for COM aggregation scenarios

Returns

Returns a managed object associated with the supplied external COM object.

Remarks

This method override is for registering an aggregated COM instance with its associated inner. The inner will be released when the associated wrapper is eventually freed. Note that it will be released on a thread in an unknown apartment state. If the supplied inner is not known to be a free-threaded instance then it is advised to not supply the inner.

If the wrapper instance already has an associated external object a NotSupportedException will be thrown.

Applies to