cnd
cnd

Reputation: 33754

How to get guid from unknown com object interface (e.g. connection point)?

I've got running service which is available via COM. I can connect with it by using Activator.

I connect COM library

using MyLib;

and then get my object by Instance

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

this is actually IConnectionPointContainer

there are several connection points and to get one there is

FindConnectionPoint(SomeGuidHere, out MyConnectionPoint);

if I remember correctly in cpp atl there is just __uuid(IHelloWorld)

the problem is: how to get guide of some "IHelloWorld" interface (connection point) in the Container ?

Upvotes: 2

Views: 1985

Answers (2)

Brian G
Brian G

Reputation: 233

If you have a reference to the interface, you can get the GUID from the type.

typeof(IHelloWorld).GUID

Upvotes: 0

Frank Pfattheicher
Frank Pfattheicher

Reputation: 432

Use EnumConnectionPoints() as described in this answer.

Upvotes: 2

Related Questions