ComWrappers.GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags) 方法

定义

获取当前注册的托管对象或创建新的托管对象并注册它。

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

参数

externalComObject
IntPtr

nativeint

要导入便于在 .NET 运行时中使用的对象。

flags
CreateObjectFlags

用于描述外部对象的标志。

返回

与提供的外部 COM 对象关联的托管对象。

注解

如果以前使用此ComWrappers实例为指定的 externalComObject 创建托管对象,则将返回以前创建的对象。 否则,将创建一个新。

适用于