views:

54

answers:

1

Hi there,

I'd like to enumerate all IDispatch supporting objects on a machine. At the moment I need to know what the class id or prog id is but, for inspecting my machine, I'd like to know if I can just enumerate all the objects that implement IDispatch.

Is this even possible?

Any help would be much appreciated :)

+1  A: 

That's a very odd request. The rub is in the "all" stipulation. Simple enumeration through the HKCR\Typelib key and LoadTypeLib() isn't enough, a COM server is not required to publish a type library. You would actually have to CoCreateInstance() the coclass and QueryInterface for IDispatch. Not only is this slow, it is also risky.

You might get a better answer if you explain why you would actually contemplate doing something like this. Calling IDispatch::Invoke() without having some kind of idea what the arguments mean or what the side-effects might be is a recipe for disaster. Stay away from method names like "ReformatDrive".

Hans Passant
Its really a bit of an academic exercise in finding IDispatch implementations. Amongst other things im interested to see what is available and either badly, or un, documented. I was hoping you could create an IEnum*, to find them all. I assume the ClassIDs are all in the registry or is this no, necessarily,t the case ....
Goz
I should add i'm quite aware of the havoc I could accidentally unleash but, equally, i'm very aware of the power one can gain from doing this ...
Goz