Results 1 to 4 of 4

Thread: Dual Interfaces?

  1. #1

    Thread Starter
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169

    Unhappy Dual Interfaces?

    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
    That which does not kill us, only makes us stronger.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I have a feeling that Dual Interfaces are to support pointerless languages like VB.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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++ ) will be able to use the component. I think one IDispatch interface is enough.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169
    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.

    That which does not kill us, only makes us stronger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width