Re: dual interface for IDispatch
"George" <George@discussions.microsoft.com> wrote in message
I have a further question, sometimes I notice that the component
actually implements the dual interface, but in the IDL file, "dual"
property is not added to the interface property.
1. Is it good practice?
2. What is the purpose of doing so?
When an interface is marked [dual] in the IDL, MIDL compiler generates
two interface descriptions in the type library - one for regular
interface and one for dispinterface - under the same IID. Without
[dual], it will generate just the former. This may or may not be
important to a particular client.
Force user to use IDispatch other
than efficient vtable?
If I wanted to do that, I'd not define vtable interface at all, just a
dispinterface. The whole point of a dual interface is to allow the
client to choose whether to call through vtable or though
3. Could we use vtable even if dual property is not added to
For example, using QueryInterface to get some interface
IIX other than IDispatch and IUnknown?
If QueryInterface is implemented appropriately by the component, yes.
With best wishes,
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