how many parameters does the "invoke" method of a IDispatch interface need to be called?

i came across some source code using 9 parameters as below:

  IDispServ * This,
  DISPID dispIdMember,
  REFIID riid,
  LCID lcid,
  WORD wFlags,
  DISPPARAMS FAR* pDispParams,
  VARIANT FAR* pVarResult,
  EXCEPINFO FAR* pExcepInfo,
  unsigned int FAR* puArgErr

but msdn omits the first parameter, that is, IDispServ.
Posted on 2011-12-04 16:40:24 by hakand
IDispatch.Invoke has in fact 9 parameters. The first one is omited in the documentation, since it is part of the COM calling convention, which is stdcall with the first parameter always pointing to a pointer to the virtual method table of the server object.

Regards, Biterider
Posted on 2011-12-05 00:43:18 by Biterider
im pretty sure the c++ can carry 16, and possibly more under some runtime debug models, as its like vararg, but i could be wrong
Posted on 2011-12-05 02:33:41 by Homer
I don't think there's a hard limit at all.
Regular cdecl and stdcall conventions pass the parameters on stack, so you can pass as many as you like.
Others, like fastcall, may start with registers, but will push excess parameters on stack as well, so again there is no limit.
Posted on 2011-12-05 08:27:12 by Scali
thank you for your replies.

and biterider can you extend your explanation a bit more pls?
Posted on 2011-12-05 17:15:36 by hakand
If you look at the documentation, you hardly will find this hidden pointer, which is passed first (or last since it is stdcall). It is always there in all COM calls. This pointer is the pointer you get when you request for an interface, for example using an IID.
COM is a topic per se, which I think you know enough about. If not, look for some supporting code here in the forum.

Posted on 2011-12-06 00:35:45 by Biterider