ComWrappers.CreateObject 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| CreateObject(IntPtr, CreateObjectFlags) |
为指向的对象 |
| CreateObject(IntPtr, CreateObjectFlags, Object, CreatedWrapperFlags) |
通过 |
CreateObject(IntPtr, CreateObjectFlags)
- Source:
- ComWrappers.cs
- Source:
- ComWrappers.cs
- Source:
- ComWrappers.cs
- Source:
- ComWrappers.cs
- Source:
- ComWrappers.cs
为指向的对象 externalComObject 创建一个托管对象,并遵循其值 flags。
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
用于描述外部对象的标志。
返回
与提供的外部 COM 对象关联的托管对象。
注解
如果无法创建并 null 返回对象,则调用 GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags) 将引发一个 ArgumentNullException。
适用于
CreateObject(IntPtr, CreateObjectFlags, Object, CreatedWrapperFlags)
- Source:
- ComWrappers.cs
- Source:
- ComWrappers.cs
通过 externalComObject 遵循 的值 flags为指向的对象创建托管对象。
protected:
virtual System::Object ^ CreateObject(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags, System::Object ^ userState, [Runtime::InteropServices::Out] System::Runtime::InteropServices::CreatedWrapperFlags % wrapperFlags);
protected virtual object? CreateObject(IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags, object? userState, out System.Runtime.InteropServices.CreatedWrapperFlags wrapperFlags);
abstract member CreateObject : nativeint * System.Runtime.InteropServices.CreateObjectFlags * obj * CreatedWrapperFlags -> obj
override this.CreateObject : nativeint * System.Runtime.InteropServices.CreateObjectFlags * obj * CreatedWrapperFlags -> obj
Protected Overridable Function CreateObject (externalComObject As IntPtr, flags As CreateObjectFlags, userState As Object, ByRef wrapperFlags As CreatedWrapperFlags) As Object
参数
- externalComObject
-
IntPtr
nativeint
要导入以供使用的.NET运行时的对象。
- flags
- CreateObjectFlags
描述外部对象的枚举值的按位组合。
- userState
- Object
调用提供 GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags, Object)的用户状态。
- wrapperFlags
- CreatedWrapperFlags
此方法返回时,包含用于描述已创建的包装对象的标志。
返回
返回与提供的外部 COM 对象关联的托管对象。
注解
默认实现引发 NotImplementedException。
如果无法创建并 null 返回对象,则调用 GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags, Object) 将引发一个 ArgumentNullException。