How to list all co-classes that implement a particular COM interface?

I’ll talk about the problem as simple as possible,

Let's say we have a com client that defines several interfaces.

To improve the functionality of the client client; Several independent companies develop and deploy com servers that implement the interface. It is possible that there may be com servers on the target machine that implement the same interface.

Now here is the problem:

Our com client has no idea about com servers on the target machine, because they will be developed independently. However, we may ask independent companies to complete a specific installation procedure.

Now here is the question:

What technique should we use to find out all compatible com servers deployed on the target machine, and then create the required objects?

+4
source share
2 answers

There is no standard COM cataloging service that I know of, although COM + may have something. Take a look at the HKCR\Component Categories , you will find the component type GUID. Like 0DE86A57-2BAA-11CF-A229-00AA003D7352, described as "Class implements IPersistPropertyBag". The component declares the same manual in its CLSID\{guid}\Implemented Categories . This seems like a good match for your scenario.

You will need to select a guide and tell the authors about it. They need to write the "Implemented Categories" key with their installer.

This is still quite inconvenient if you use the CLSID keys, you do not want to do this very often. But at least you don't have to download DLLs to discover interfaces that can have all kinds of unpleasant side effects. I would recommend a dialog in the Options menu that allows the user to start scanning and select, as well as a good way to disable the incorrect components.

Btw, the support pain it can cause usually makes applications work from an “approved” list.

+4
source

Hans had a great idea.

I have not used component categories before, but I suggest you not touch the registry directly, since MS provides an API for accessing component categories. Check this:

http://msdn.microsoft.com/en-us/library/ms692551(v=vs.85).aspx

0
source

All Articles