B
Bartholomew Simpson
I know this is a VB.Net ng. But hopefully, someone remembers some
classic (VB6) coding - besides I've not had any response when I posted
this to the VB6 specific ng.
I wrote a C++ librray that I want to use in VB6. I have exported a C API
(via a win32 DLL) that may be used in VB6 using the 'Declare Function'
syntax.
However, I need to group related functions together (in VB6), by
wrapping them together in a VB6 class.
Assuming CreateNewObject is an exposed C function that returns a pointer
to a C++ object is declared in VB6 as follows:
Declare function CreateNewObject lib "mylib" () as long
Using the plain API (without wrapping the C++ objects in a VB6 class), I
would have code that looks like this :
dim lngPtr as long
lngPtr = CreateNewObject() 'calls Dll function
With the exposed C functions wrapped up in VB6 classes, the code looks
something like this:
dim objVBWrapper as MyVBWrapperClass
// which of these statements are correct?
objVBWrapper = CreateNewObject() //OR
Set objVBWrapper = CreateNewObject()
The key difference here is that I am creating the object by assignment.
Since there is no explicit copy constructor in VB6 I'm not sure how this
may be implemented. Ideas please ...
classic (VB6) coding - besides I've not had any response when I posted
this to the VB6 specific ng.
I wrote a C++ librray that I want to use in VB6. I have exported a C API
(via a win32 DLL) that may be used in VB6 using the 'Declare Function'
syntax.
However, I need to group related functions together (in VB6), by
wrapping them together in a VB6 class.
Assuming CreateNewObject is an exposed C function that returns a pointer
to a C++ object is declared in VB6 as follows:
Declare function CreateNewObject lib "mylib" () as long
Using the plain API (without wrapping the C++ objects in a VB6 class), I
would have code that looks like this :
dim lngPtr as long
lngPtr = CreateNewObject() 'calls Dll function
With the exposed C functions wrapped up in VB6 classes, the code looks
something like this:
dim objVBWrapper as MyVBWrapperClass
// which of these statements are correct?
objVBWrapper = CreateNewObject() //OR
Set objVBWrapper = CreateNewObject()
The key difference here is that I am creating the object by assignment.
Since there is no explicit copy constructor in VB6 I'm not sure how this
may be implemented. Ideas please ...