locked
How can I expose multiple interfaces within a runtime class??

    Question

  • I have a traditional DLL and encapsulate it with IInspectable. Within a runtime class, I only put a interface in the idl file. How can I modify my idl file to expose multiple interfaces within one runtime class and how to modify the class body or I only need to inherit multiple interfaces??
    Tuesday, October 25, 2011 7:28 AM

Answers

  • In your IDL file, you simply add the new interfaces to your runtimeclass declaration:

     

    runtimeclass MyRuntimeClass

    {

        [default]interface IMyInterface1;

        interface IMyInterface2;

    }

    This says that the object MyRuntimeClass implements the interfaces IMyInterface1 and IMyInterface2.  When MyRuntimeClass is used as a parameter in a method, the IMyInterface1 interface will be expected (it's what I call the "stand-in" interface for the runtime class.


    Btw, the documentation for the low level (IDL) authoring experience has not yet been released at this time, we will be documenting it at a later time.
    Thursday, October 27, 2011 1:05 AM

All replies

  • In your IDL file, you simply add the new interfaces to your runtimeclass declaration:

     

    runtimeclass MyRuntimeClass

    {

        [default]interface IMyInterface1;

        interface IMyInterface2;

    }

    This says that the object MyRuntimeClass implements the interfaces IMyInterface1 and IMyInterface2.  When MyRuntimeClass is used as a parameter in a method, the IMyInterface1 interface will be expected (it's what I call the "stand-in" interface for the runtime class.


    Btw, the documentation for the low level (IDL) authoring experience has not yet been released at this time, we will be documenting it at a later time.
    Thursday, October 27, 2011 1:05 AM
  • Thank you for replying, but if both of interfaces IMyInterface1 and IMyInterface2 all inherit from IInspectable, can I recognize the IMyInterface2 when MyRunTimeClass is used as a parameter in a method. If not, how can I change to IMyInterface2??

    Can I write in this way

    runtimeclass MyRuntimeClass

    {

        interface IMyInterface1;

        interface IMyInterface2;

    }

    None of these interfaces with attribute [default], then can I use some method to query the interface I need?? just like queryinterface. Because I don't want the user can see the interfaces they don't need.

    Monday, November 21, 2011 9:27 AM