Re: IDispatch vs. Dual interfaces
"vicmann" <vicmann@hotmail.com> wrote in message
news:esnjQI$9GHA.1172@TK2MSFTNGP03.phx.gbl
An IDispatch* interface has only the following methods exposed:
QueryInterface, AddRef, Release, GetTypeInfoCount, GetTypeInfo,
GetIDsOfNames and Invoke.
IDispatch interface does define some methods by user, but will ONLY be
invoked by "name->Dispatch ID" mechanism.
A Dual Interface (derived from both IUnknown and IDispatch) includes
all the above methods plus other user-defined/exposed methods. And
its methods can be called via v-table or Invoke().
1. Is this the correct understanding about the difference between
IDispatch and Dual Interface?
Yes.
2. Since ATL Wizard only allow choose between Custom and Dual
Interface, how to make an IDispatch* interface only?
By hand. You manually delete the interface the wizard creates for you,
derive your class from IDispatch and implement its methods.
3. Choice between Custom and Dual Interface is on the property page
of ATL Object Wizard. Once selected, does it mean that all interfaces
in this object will be the same as chosen, or in another words, can
both interfaces co-exist in an object?
You can implement only one dual interface on an object, together with an
arbitrary number of custom interfaces. The wizard helps you out by
setting up the first interface (either dual or custom), but you can
manually add more later.
--
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