I want to enumerate the interfaces an object supports. Is this to be done manualle (check all entries in HKEY_CLASSES_ROOT\Interface) or is there a better solution?
Posted on 2001-07-19 09:02:52 by japheth
That's it. COM is built on the assumption a developer has all the info on the objects needed.

That's why QueryInterface takes an IID but doesn't return one, ie, it doesn't enumerate it's interfaces for you.
Posted on 2001-07-19 19:12:02 by Ernie
you can do it like the "oleview" toolfrom Microsoft, which enumerates the
interfaces by asking ALL available interface to the object,
and listing those, where the object returns ok :)
Posted on 2001-07-23 03:53:31 by beaster
Nope, that's not what OleView is doing at all. It's actually reading the type librarys for registered objects.

The COM contract only states one MAY post info in the type lib, not that one MUST, nor make it publish every interface.

And reading typelibs in code is one sure path to madness.
Posted on 2001-07-23 18:18:43 by Ernie
> It's actually reading the type librarys for registered objects

this seems to be for objects that provide typelibs.

I tried to debug my own .ocx control and lauched oleview
and opened there my own activex object. I'd like to see, which
interfaces I correctly export to windows and which ones not.

I made a MessageBox inside QueryInterface, that shows up,
if an interface is queried which I don't implement.

Right after starting this, I got about 1000 MessageBoxes with
all available interfaces from the system. A look into a registry
monitor during this told me, that oleview really enumerates all
interface IDs from HKEY_CLASSES_ROOT.

Posted on 2001-07-24 03:55:47 by beaster
I do like OLEVIEW does and it works without problem and sufficiently fast (read all IIDs in a memory buffer by scaning CLSID\Interface one time and then query the objects with all of them).
Posted on 2001-07-24 10:14:37 by japheth