> I'd like to know if and how it is possible to
> enumerate all the early-binding refernces of
[quoted text clipped - 4 lines]
>
> Thanks for any help.
Assuming that you're still working on your object
browser, and that you're filtering Typekinds 4 and
5 in your enumeration of TypeInfos (to get Dispatch
interfaces and creatable objects) I think you can just
add Typekind 3 to that filter for early-bound interfaces.
3 TKIND_INTERFACE
4 TKIND_DISPATCH
5 TKIND_COCLASS
From tlbinf32.chm:
3 TKIND_INTERFACE - Description of an IUnknown derived vtable.
If you have the help file, look up Typekinds.
In practice, nearly all COM objects seem to have
dual interfaces, supporting both early and late
binding. The only exception I can think of that I've
come across is msi.dll, which has only a dispatch
interface for some reason. (I suppose MS didn't
want VBers mucking around in there. There's a
fullscale C++ API and a full scripting automation
object model, but that's it.)
I'm not entirely clear about the structure of the
two interfaces, but it seems to me that early binding
comes first and making it dual is an option. According
to the book "The Essence of COM", concerning the
creation of a dual interface:
"You do this by deriving your custom VTBL interface
fromIDispatch rather than IUnknown, and specifying
the IDL attribute dual."
I may be wrong in my understanding, but that seems
to be saying that the way to have late binding is by
adding the IDispatch interface methods in between the
IUnknown and the beginning of the vTable. So the
implication seems to be that MS had to actually go to
some kind of extra effort to avoid exposing the vTable.
Maybe someone else has a more complete explanation
of how that all fits together.
Steve Gerrard - 05 Oct 2007 16:27 GMT
> I may be wrong in my understanding, but that seems
> to be saying that the way to have late binding is by
[quoted text clipped - 5 lines]
> Maybe someone else has a more complete explanation
> of how that all fits together.
I suspect that on a matter such as this, none of us really knows, but I think
you are right, adding IDispatch, and an implementation of it, is optional. I
would think that not having early binding could be accomplished by simply not
exporting any methods, i.e. not having any externally public methods. Building a
dll with no methods that can be called directly, in other words. If you then add
IDispatch, you have a late binding only dll.