ComWrappers.CreateObject(IntPtr, CreateObjectFlags) 方法

定义

采用 flags 的值为 externalComObject 指向的对象创建托管对象。

protected:
 abstract System::Object ^ CreateObject(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags);
protected abstract object? CreateObject (IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags);
abstract member CreateObject : nativeint * System.Runtime.InteropServices.CreateObjectFlags -> obj
Protected MustOverride Function CreateObject (externalComObject As IntPtr, flags As CreateObjectFlags) As Object

参数

externalComObject
IntPtr

nativeint

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

flags
CreateObjectFlags

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

返回

Object

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

注解

如果无法创建并 null 返回对象,则调用 GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags) 将引发一个 ArgumentNullException

适用于