2

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 ?

cnd
  • 32,616
  • 62
  • 183
  • 313

2 Answers2

2

Use EnumConnectionPoints() as described in this answer.

Community
  • 1
  • 1
  • so... is it a joke? I don't see. – cnd Feb 04 '13 at 10:42
  • @ℋeatђer: Not a joke, just the link was not properly formatted. Fixed it. – sharptooth Feb 04 '13 at 12:39
  • I see but sadly in example he's getting full list of points and it's some overhead comparing to way when I use an static uuid. But yet I can't find better solution I mark this one as answer. – cnd Feb 04 '13 at 12:57
0

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

typeof(IHelloWorld).GUID
Brian G
  • 233
  • 2
  • 6
  • That doesn't require a reference to the COM interface, just knowing the type name of the wrapper type. If you had a reference to the actual instance you'd need to use GetType(). And if it's a simple object reference you'll be disappointed at the results of it. I'm still trying to figure out if there's any way to find the GUID of a __ComObject (the internal type the runtime holds it in) when all you have is an IUnknown as a System.Object ... really looks like there's no legit way to do it ... – Aaron Carter Oct 14 '22 at 06:27