Question

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 :)

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top