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

Thread: Class in Adll

  1. #1
    Join Date
    Jul 1999
    Posts
    84

    Class in Adll

    Hello,

    I want to know how can I create an object of a class in VB that is present in the Dll created in VC++.

    Any help will be greatly appreciated and rated

    Regards

    Thanks
    Harini

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Class in Adll

    You can create a class in a VC dll by using the program ID of the class. You can use two ways of doing so, the first is to create a refference to the dll using the project>refferences menu. After that, you can just Dim the class in code.
    The second option is using CreateObject, which doesn't require you to add az refference, but results in loosing all the early-bound advantages (like autocompletion and stuff). Here's that in code:

    ' early bound, need to add refference to project
    Dim myObject as MyDll.MyClass
    set myObject = new MyDll.MyClass
    myObject.SomeMethod ' call a method

    ' late bound, no need to add refference
    Dim myObject as Object
    set myObject = CreateObject("MyDll.MyClass")
    myObject.SomeMethod ' call a method




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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