문제

How do you get a pointer to an existing COM object that has been created on the same machine, in a different process?

I have a Credential Provider which creates an object that inherits ICredentialProvider. ICredentialProvider has a method SetSerialization.

I also have a service, from which I need to call the SetSerialization method of the Credential Provider. The thing is, I'm experienced in C++, but I'm a beginner with COM, so I don't know how. Microsoft's sample 'CSampleProvider's comments say to call the SetSerialization method from a 'remote client', but don't explain how - I assume they assume you know COM.

I've been reading MSDN and various tutorials about COM all day, and I've got to a point where I can create an instance of my Credential Provider in the service, but I need to get a pointer to the Credential Provider object that already exists, not create a new one, and I can't find out how.

How is it done?

Thanks.

도움이 되었습니까?

해결책

The canonical method is via the Running Object Table. That assumes the object has a "moniker", i.e. a COM name, and that this moniker is registered.

Note that the ROT is a form of IPC, specifically a systemwide directory of COM objects.

다른 팁

As Raymond said, in short, you can't - not by any built in COM functionality at least. If you must, it will need to be passed via some form of Inter Process Communication.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top