Announcement

Collapse
No announcement yet.

PowerBase INHERIT IDISPATCH

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PowerBase INHERIT IDISPATCH

    Currently, the statement INHERIT IDISPATCH is used to signify a dual interface (a combination of direct VTable and Dispatch).
    The statement INHERIT DUAL is accepted as a synonym.

    In order to provide you with greater capabilities in the future, we have decided to disallow INHERIT IDISPATCH,
    so that it can be reserved for another purpose in the future.

    This change will be effective with PBCC 5.01 and PBWin 9.01, which will be available in the near future.
    We recommend that you change all instances of INHERIT IDISPATCH to INHERIT DUAL in your current programs to
    avoid any conflicts with the upcoming release.
    This makes me happy because from a low-level COM perspective, I found the statement INHERIT IDISPATCH as
    signifying a dual interface confusing.

    But does this also apply to the declaration of an interface? For example, given the following interface
    Code:
    [
     odl,
     uuid(D1B6F1CB-C9DA-47A1-B58A-7BF32EB62CE2)
    ]
    interface _Icon : IDispatch {
       HRESULT _stdcall LoadBitmap([in] BSTR FileName);
       HRESULT _stdcall LoadIcon([in] BSTR FileName);
       [propget]
       HRESULT _stdcall index([out, retval] long* pVal);
       [propput]
       HRESULT _stdcall index([in] long pVal);
       [propput]
       HRESULT _stdcall HBITMAP([in] unsigned long rhs);
       [propget]
       HRESULT _stdcall maskColor([out, retval] unsigned long* pVal);
       [propput]
       HRESULT _stdcall maskColor([in] unsigned long pVal);
       [propput]
       HRESULT _stdcall HICON([in] unsigned long rhs);
    };
    My natural inclination was to use INHERIT IDISPATCH in the PB declaration, but was stopped dead in
    my tracks when I read that the statement signified a dual interface. But Jose cleared things up with
    this reply
    INHERIT IDispatch defines a dual interface when you are writing classes with PB to build a COM server,
    but when it is a declaration to use a server as a client, it simply defines that it is an interface that inherits from IDispatch.
    Therefore, does this change in the meaning of INHERIT IDISPATCH affect the declaration of the interface shown above?
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

  • #2
    Therefore, does this change in the meaning of INHERIT IDISPATCH affect the declaration of the interface shown above?
    I'm afraid. The post advises to "change all instances of INHERIT IDISPATCH to INHERIT DUAL". While it makes sense to use INHERIT DUAL in the classes, it would be confusing in the declaration of an interface like the one that you have posted, that inherits from IDispatch but is not dual.

    Also, it doesn't make much sense to use INHERIT DUAL in an event class.
    Last edited by José Roca; 22 Oct 2008, 07:27 PM.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      It would be nice if PB just let the INHERIT IDISPATCH statement mean inherit IDispatch.
      I mean we have precedents.
      IUnknown interface - INHERIT IUNKNOWN
      Automation-compatible IUnknown interface - INHERIT IAUTOMATION
      Dual IDispatch interface -INHERIT DUAL

      Also, it doesn't make much sense to use INHERIT DUAL in an event class.
      That is being very polite. This just leaves my updated COM-code generator and type library
      browser hanging in mid air.
      Last edited by Dominic Mitchell; 22 Oct 2008, 07:43 PM.
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment

      Working...
      X