"Jeff M." <
[hidden email]> wrote in message
news:
[hidden email]...
> So, I'm wrapping up a COM object, and looking through some of the ones
> in the community image as examples. And, typically I see a definition
> like this:
>
> <virtual stdcall: sdword 4 IUnknown* GUID* IUnknown**>
>
> Now, I assume that the '4' is the index into the virtual function table
> where this function is located. However, in the documentation I can
> find no reference to how this is gotten.
>
> Any pointers? No pun intended. :-)
>
Usually it is extracted automatically from a type-library by the type
library analyzer (which is used the the AX Component Wizard to generate
wrapper classes). If you don't have a type-library, then you can build one
from IDL. If you don't have IDL, then you can construct it pretty easily (in
most cases) from the C/C++ .h file. This will work even for custom
(non-automation) interfaces, although there is some loss of fidelity in the
tlb representation that can lose some of the nuances in the original IDL.
Usually this is not a significant issue, however.
If you don't want to go down the automatic generation route (and there are a
lot of advantages to doing so, not least avoiding the need to do tedious and
error prone translation), then you will need to work out the vtbl indices
yourself. This is pretty easy though - just count the methods all the way
up the inheritance hierarchy, including IUnknown.
Regards
Blair