ComWrappers.GetOrCreateComInterfaceForObject 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建可传递给非托管环境的提供的对象的 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 运行时外部传递。
注解
如果以前为此实例指定的指定instance
ComWrappers创建了 COM 表示形式,将返回以前创建的 COM 接口。 否则,将创建一个新项。