ComWrappers.GetOrCreateComInterfaceForObject 方法

定义

创建可传递给非托管环境的提供的对象的 COM 表示形式。

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

参数

instance
Object

要公开.NET运行时外部的托管对象。

flags
CreateComInterfaceFlags

用于配置生成的接口的标志。

返回

IntPtr

nativeint

生成的 COM 接口作为指向 IUnknown 接口实现的指针,可在.NET运行时外部传递。

注解

如果以前为此实例指定的指定instanceComWrappers创建了 COM 表示形式,将返回以前创建的 COM 接口。 否则,将创建一个新项。

适用于