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

    Accessing VB COM object from Vicual C++

    Hi, I wonder if anyone can help.

    I have created a COM object in the form of a dll using VB6.

    I would like to know how I can access this COM object in C++. I would usually use CoCreateInstance but that requires my C++ code to have knowledge of the interfaces supported by my VB COM object. I usually use the .H file containing the interfaces and IIDs (so I can declare a pointer to my interface, eg, KCPInterface* myInterfacePtr - then pass this to CoCreateInstance. I hope the above makes sense, thanks in advance for any help, I'm stuck on this one!!!


  2. #2
    Join Date
    Apr 1999
    Location
    VA BEACH
    Posts
    467

    Re: Accessing VB COM object from Vicual C++

    you can do one of two things.
    a) use the class wizard and select Add New class. Then select from type library, and choose you dll. This is the harder way.

    b) use smart pointers generated by using the #import directive.



    #import "c:\my dlls\somedll.dll" no_namespace





    this will generate the smartpointer and function definitions so that you can use them in your program. Take a look on MSDN for smart pointers or post something specific you want to do and I will try to help.



    Jim Hewitt
    Software Developer
    Liberty Tax Service
    www.LibertyTax.com

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