CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    30

    vb & c++ & COM & automation



    Can I return the IUnknown pointer of a typelib's coclass or do I have to return the default interface pointer specified in my idl file? For example:


    coclass MyCollection

    {

    [default] dispinterface IMyInterface;

    interface IMyOtherInterface;

    }


    is a collection object I am exposing to vb automation clients from my c++ app. When accessed, I create my COM object and return its IUnknown.


    But I am having problems with certain vb syntax when traversing the returned collection. If the vb code uses either the "for each object" or "MyCollection.Item(index)" syntax, everything is fine. But if I try to use "MyCollection(index)", vb calls the wrong function on MyCollection.


    Neither my "Automation Programmer's Reference" book nor C++ documentation say what is expected to be passed from the server but from what I have read I am coming to the belief that I always have to return the default interface of any coclass in the typelib.

  2. #2
    Join Date
    Apr 1999
    Posts
    7

    Re: vb & c++ & COM & automation



    You should post this topic in the Visual C++ board on codeguru.com, not in the Visual Basic board here...

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