Here you go empty:
http://www.robertknight.me.uk/files/temp/VBCOMDEMO.dll
Object: VBCOMDEMO.DEMOCLASS
Properties: intVal,floatVal,strVal
Methods:
squareInt() - Returns the square of intVal
showValues(int,float,str) - Pops up message boxes with parameters, then adds params to intVal,floatVal,strVal properties, and pops up message box with result
addFloatToInt() - Adds floatVal to intVal
addStrToInt() - Adds strVal to intVal
==========
VB code for class:
Public intVal As Long
Public floatVal As Single
Public strVal As String
Public Function squareInt() As Integer
squareInt = intVal * intVal
End Function
Public Function showValues(showInt As Integer, showFloat As Single, showStr As String) As Boolean
MsgBox "Int Parameter: " + CStr(showInt)
MsgBox "Float Parameter: " + CStr(showFloat)
MsgBox "Str Parameter: " + CStr(showStr)
intVal = intVal + showInt
floatVal = floatVal + showFloat
strVal = strVal + showStr
MsgBox "New Int Value: " + CStr(intVal)
MsgBox "New Float Value: " + CStr(floatVal)
MsgBox "New String Value: " + CStr(strVal)
End Function
Public Function addFloatToInt()
intVal = intVal + floatVal
End Function
Public Function addStrToInt()
intVal = intVal + Val(strVal)
End Function
VB code to use ActiveX DLL
Dim vbdll As Object
Set vbdll = CreateObject("VBCOMDEMO.DEMOCLASS")
vbdll.intVal = 2
vbdll.floatVal = 2.5
vbdll.strVal = "Hello World!"
MsgBox vbdll.squareInt()
vbdll.showValues 1, 2.5, " - I am a concanted string"
vbdll.addFloatToInt
vbdll.addStrToInt
MsgBox vbdll.intVal
ActiveX from C++ ain't easy.