如何从未知的com对象接口(例如连接点)获取guid?

时间:2013-02-04 08:25:44

标签: c# com interface guid connection-points

我有通过COM提供的运行服务。我可以使用Activator连接它。

我连接COM库

using MyLib;

然后通过Instance获取我的对象

Activator.CreateInstance((Type.GetTypeFromProgID("RunningInstance")));

这实际上是IConnectionPointContainer

有几个连接点,并且有一个连接点

FindConnectionPoint(SomeGuidHere, out MyConnectionPoint);

如果我在cpp atl中记得正确的话只有__uuid(IHelloWorld)

问题是:如何在Container中获得一些“IHelloWorld”界面(连接点)的指南?

2 个答案:

答案 0 :(得分:2)

this answer

中所述使用EnumConnectionPoints()

答案 1 :(得分:0)

如果您有对该接口的引用,则可以从该类型获取GUID。

typeof(IHelloWorld).GUID