Re: IDispatch interface
nly <nlyee2001@yahoo.com> wrote:
Does Automation in COM has to be implemented with IDispatch interface?
Yes. By definition, an automation server is any COM object implementing
IDispatch interface.
Are IDispatch, dispatch interface, dipinterface referring to the same
thing?
More or less. A dispinterface is a specific contract on what individual
DISPIDs mean for a particular IDispatch implementation, and what
parameters should accompany each DISPID value. Similar to how a regular
interface is a contract on what individual vtable entries mean, and what
parameters should accompany a call through each vtable entry.
IDispatch interface has 4 methods: Invoke, GetIDsOfName, GetTypeInfo,
and GetTypeInfoCount. My question is when a client calls a method of
the object, for example,
Set obj = CreateObject("Excel.Application")
...
Obj.CheckSpelling(Word);
In what steps that "GetIDsOfName" is triggered to translate the
function name, "CheckSpelling", into a DISPID?
What do you mean, in what steps? I don't understand this question. In
case you are asking for confirmation, yes, GetIDsOfNames is used to
translate method name into a DISPID, then Invoke is used to actually
call the method.
Is it correct to say that in the above VB example, the client code
does the translation?
Well, the client code calls GetIDsOfNames, and the server's
implementation of this method returns the DISPID. It's hard to say which
side is "more responsible" for the action.
Can somebody explain the steps, specifically
when "GetIDsOfName" is called?
Whenever you have a method name and want to know corresponding DISPID -
usually so that you can pass it to Invoke.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925