Click to See Complete Forum and Search --> : Dual Interfaces?
wolfofthenorth
Jul 30th, 2001, 01:02 PM
Hi,
If an object exports IUnknown, IDispatch, and a Dual Interface. What is the advantage of having the dual interface over an interface derived directly from IUnknown? Can't the regular IDispatch provide any functionality needed?
If I have a reference to a dual interface and I try to get an IDispatch reference do I get an IDispatch reference to the same interface I was in or to the "real" IDispatch?
Thanks for any help
:)
parksie
Jul 30th, 2001, 01:16 PM
I have a feeling that Dual Interfaces are to support pointerless languages like VB.
parksie
Jul 30th, 2001, 03:07 PM
Originally written in "Special Edition Using Visual C++ 5"
COM objects communicate through interfaces, a collection of function names that describe the possible behaviour of a COMD object. To use an interface you get a pointer to it and then call a member function of the interface. All Automation servers and ActiveX controls have an IDispatch interface in addition to any other interfaces that may be specific to what the server or control is for. To call a method of a control, you can use the Invoke() method of the IDispatch interface, passing in the dispid of the method you wish to invoke. (This technique was developed so that methods could be called from Visual Basic and other pointerless languages.)This means that IDispatch is required for VB (you need to use Dual Interfaces). Otherwise only pointer-capable languages (C++ :D) will be able to use the component. I think one IDispatch interface is enough.
wolfofthenorth
Jul 31st, 2001, 10:16 AM
Thanks for helping me out.
I also thought that one IDispatch was enough, but some diagrams I have seen shows multiple occurances of it. I was wondering why this would be desirable. Thanks for helping clear this up.
Although I am under the impression that VB6 has the capability of direct vTable binding. I thought that IDispatch is not neccessary for this type of binding. Is this correct or am I still missing something?
One last thing. If an interface is derived from IDispatch, can an IDispatch reference be used to accesss that interface? I think yes, but have had some difficulty in proving it to myself.
Thanks again for your help.
:) :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.