CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2000
    Posts
    20

    Why VB can not Implements the interface?

    I define a interface.
    Then reference the TLB and implement it in VB use statement "Implements".
    But IView dose not show in class list.
    Why?
    Thanks for any suggestion.

    [
    object,
    uuid(319E85A1-E279-11D3-9D78-00A0C9D4D5F3),
    dual,
    oleautomation,
    helpstring("IView Interface"),
    pointer_default(unique)
    ]
    interface IView : IDispatch
    {
    [propget, id(1), helpstring("property ID")] HRESULT ID([out, retval] long *pVal);
    [propput, id(1), helpstring("property ID")] HRESULT ID([in] long newVal);
    [id(2), helpstring("method Create")] HRESULT Create([in]IFrame * parent);
    [propget, id(3), helpstring("property hWnd")] HRESULT hWnd([out, retval] long *pVal);
    [id(4), helpstring("method SetExtent")] HRESULT SetExtent([in]int left,[in]int top, [in]int width, [in]int height);
    [id(5), helpstring("method Destroy")] HRESULT Destroy();
    [id(6), helpstring("method Show")] HRESULT Show();
    [id(7), helpstring("method Hide")] HRESULT Hide();
    [id(8), helpstring("method GetMenu")] HRESULT GetMenu([out]long * hMenu);
    [id(9), helpstring("method InvokeCommand")] HRESULT InvokeCommand([in]long ID);
    [id(10), helpstring("method UpdateCommand")] HRESULT UpdateCommand([in]long ID,[in] ICommandUI * pCommandUI);
    [id(11), helpstring("method GetToolbar")] HRESULT GetToolbar([out]VARIANT * text,[out]VARIANT * commandid,[out] long * bmpN,[out] long * bmpH,[out] long * bmpD);
    [id(12), helpstring("method GetStartButton")] HRESULT GetStartButton([out]BSTR * text,[out] long * imgN,[out] long * himgH,[out] long * imgD);
    };





  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Why VB can not Implements the interface?

    I'm not sure that VB will do what you are looking for. It, as of today, doesn't support inheritence. But you can get very close using interfaces, but they have to be implemented in a special way. Check out www.stlvbug.org and then goto the download code page and click on the presentation for August 1999 - Interface Programming. That may have some answers for you. It was certainly an impressive presentation - with impressive code to go along with it.

    Good luck,
    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    140

    Re: Why VB can not Implements the interface?

    I think that you need to replace the
    "IView : IDispatch { ...}"
    with "IView: IUnknown {...}"


  4. #4
    Guest

    Re: Why VB can not Implements the interface?

    I do this sort of thing, here is an example of one I implemented earlier. I think you need the library bit!

    #############################
    // std types
    import "oaidl.idl";
    import "ocidl.idl";

    ///////////////////////////////////////////////////////////////////////////////////
    // IDoBobNotify Interface
    import "IDoBobNotifyIF.IDL";

    ///////////////////////////////////////////////////////////////////////////////////
    // IDoBob Interface
    import "IDoBobIF.IDL";


    ///////////////////////////////////////////////////////////////////////////////////
    // IJimmyInterface Interface
    import "IJimmyInterfaceIF.IDL";


    ///////////////////////////////////////////////////////////////////////////////////
    // Something for a type lib
    [
    uuid(E5AA4260-E873-11d3-9A92-0000E886120C),
    version(1.0)
    ]
    library DoBobDLL
    {
    importlib("StdOle32.Tlb");
    importlib("StdOle2.Tlb");

    interface IDoBob;
    interface IDoBobNotify;
    interface IJimmyInterface;
    }

    #############################


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

Featured