Re: Dual interface
- From: George <George@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 14 Sep 2008 03:03:02 -0700
Thanks SvenC,
1.
No. If a component *only* (what do you mean with directly?) implements
and exposes (through QueryInterace) IDispatch (it must expose IUnknown
as well!) then you can use the Invoke method of IDispatch to use the
methods and properties which the COM component implements. Which
methods and properties are available could come in a typelib or in written
documentation
Sorry for my bad English, and I show here some code to clarify.
What I mean is component coclass CFoo is defined as CFoo:IDispatch, i.e.
CFoo implements IDispatch directly. And CFoo only exposes IDispatch and
IUnknown and internal implementation methods could only be called by
IDispatch.Invoke. Do you agree? :-)
I am confused about what do you mean "could come in a typelib or in written
documentation". Through typelib or through some documentation, we could have
means to call the internal implementation methods of CFoo not through
IDispatch.Invoke? What is your point to introduce typelib and document here?
:-)
2.
All COM components must implement IUnkown "by law".
I think the law should be every interface of the COM component implements,
must inherits IUnknown or be IUnknown directly. Not COM component must
implment IUnknown. For example, do you think it is legal to define a
component called CGoo, which implements IGoo and IUnknown, but IGoo is not
inheriting from IUnknown? :-)
3.
Almost. Again: no interface implements anything. So your custom
interface does not implement IUnknown. It derives from IUnknown
and so your C++ class is forced to implement the IUnknown
methods as well.
Sorry. My bad terminology if I speak too fast. :-)
Here is the corrected version of what I want to say. Do you think it is
correct now?
--------------------
3. If a component implements a customized interface, then the
customized interface derives from IUnknown, then we could invoke the
component's member methods through QueryInterface to get the
customized interface, and using the vtable in the customized
interface to invoke member methods. But still one way, so it is not
dual interface.
--------------------
4.
4. If a component implements a customized interface, then the
customized interface implements IDispatch, then we could invoke the
component's member methods through QueryInterface to get the
customized interface, and using the vtable in the customized
interface to invoke member methods, and also we could invoke through
IDispatch.Invoke. Two ways to invoke it, so called dual interface.
Same problem with your wording of interfaces implementing something.
I have corrected my wording. Could you review whether the following
statements are correct now? :-)
--------------------
If a component implements a customized interface, then the
customized interface derives from IDispatch, then we could invoke the
component's member methods through QueryInterface to get the
customized interface, and using the vtable in the customized
interface to invoke member methods, and also we could invoke through
IDispatch.Invoke. Two ways to invoke it, so called dual interface.
--------------------
have a great weekend,
George
.
- References:
- Dual interface
- From: George
- Re: Dual interface
- From: SvenC
- Re: Dual interface
- From: George
- Re: Dual interface
- From: SvenC
- Dual interface
- Prev by Date: Re: Dual interface
- Next by Date: Re: Dual interface
- Previous by thread: Re: Dual interface
- Next by thread: Auto list members
- Index(es):
Relevant Pages
|