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 ?

2 Answers 2

2

Use EnumConnectionPoints() as described in this answer.

Sign up to request clarification or add additional context in comments.

3 Comments

so... is it a joke? I don't see.
@ℋeatђer: Not a joke, just the link was not properly formatted. Fixed it.
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.
0

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

typeof(IHelloWorld).GUID

1 Comment

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 ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.