Solved
Using ActiveX DLL's as plug-ins to VB6 app.
Posted on 2004-10-06
Hi!
Can ActiveX DLL's be used as plug-ins to VB6 application?
Lets say I have an application which draws the graph of some mathematical function.
It increments the X value from 1 to 10000, and for each X it calls some mathematical function which is stored in a DLL.
Here's the example:
DLL:
- project name: TestDLLPlugInProject
- Class name: TestDLLPlugInClass
- the code for that class:
'---------------------------------------------------------
Public Function GetY(ByVal X As Single) As Single
GetY = 1000 * Sin(X)
End Function
'---------------------------------------------------------
Application:
- create command button
- add reference to TestDLLPlugInProject.DLL
'---------------------------------------------------------
Private Sub Command1_Click()
Dim Test As TestDLLPlugInClass
Set Test = New TestDLLPlugInClass
Dim x As Single
Dim y As Single
For x = 1 To 10000
y = Test.GetY(x)
Me.PSet (x, y)
Next x
End Sub
'----------------------------------------------------------
My question is: Can I have more DLL's, where each of them has TestDLLPlugInClass and GetY function, but each of them performs different math operations.
So the final user can simply select which DLL they want to use, and get different results each time.
They could also be able to create their own DLL's, and use them instead of mine.
An example of different DLL's would be:
'----------------------------------------------------------
Public Function GetY(ByVal X As Single) As Single
GetY = 1000 * Cos(X)
End Function
'----------------------------------------------------------
'----------------------------------------------------------
Public Function GetY(ByVal X As Single) As Single
If X < 500 then GetY = 100
If X >= 500 then GetY = 200
End Function
'----------------------------------------------------------
How do I do this if this is even possible?
Thanks in advance!