Click to See Complete Forum and Search --> : Class in Adll


Harini
October 15th, 2001, 11:30 AM
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

Cakkie
October 15th, 2001, 12:16 PM
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
slisse@planetinternet.be

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