我已经定义了一个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,如果问题不够具体,请告诉我进一步解释。