Re: How to find all components exposing a certain Interface
"Mrinal Srivastava" <email@example.com> schrieb im Newsbeitrag
My requirement is to develop a set of business components and the user
will chose (at runtime) which component to invoke. For this, I have
decided to create these component as COM component, all exposing one
common Interface (Say ISampleInterface). I need to show user a list of
these component for his/her to chose from.
My question is, is there any API through which I can get a list of all
registered component who are implementing/exposing this Interface (Query
by Interface name or IID, whatever is possible).
I don't think this is realy a good idea. An interface only describes a small
part of the functionality of an object. And just because two objects
implement the same interface, you can usually not replace one of these
objects by the other. Think of those lots of objects that implement IStream
or IPersistStream (not to mention of IDispatch and IUnknown). Perhaps you
think your interface is something really special (perhaps it really is) and
all objects implementing it may be used interchangeable, but what if someone
finds your interface usefull and implements it for something completly
If you want your user to select an object from a pool of similiar objects,
you should better define a component category for those objects and register
all these objects with that category. Search MSDN for "The Component
Categories Manager" to find (links to) more information.