如何指定" COM"当多个" COM" class在C ++中有相同的名字吗?

时间:2016-05-09 07:41:07

标签: c# c++ com interop com-interop

我已经定义了一个COM接口,如下所示(C#):

using System.Runtime.InteropServices;
namespace CommonInterop.Hello
{
 [ComVisible(true)]
 [Guid("24484884-DAAE-4B24-B0BD-C7B9AEB3D70D")]
 public interface IComInterop
 {
    int Plus1(int x);
 }
}

并且使用不同的命名空间 GUID 定义几乎相同的界面:

using System.Runtime.InteropServices;
namespace CommonInterop.World
{
 [ComVisible(true)]
 [Guid("66664884-DAAE-4B24-B0BD-C7B9AEB34444")]
 public interface IComInterop
 {
    int Plus1(int x);
 }
}

在C ++中的用法:

在C ++中,我得到指向对象的指针如下所示,如果只定义了COM类中的一个:

IComInteropPtr m_Interop;
 // and 
void SetSome(IComInteropPtr);

但现在我有两个" COM"具有相同类名的类。我怎样才能告诉C ++使用特定的" COM"类?

在C ++中使用im noob,如果问题不够具体,请告诉我进一步解释。

0 个答案:

没有答案