sorry, didn't give enough info
I want to learn to use the declare statement in case I need to create non-VB DLLs in the future. It is very frustrating that I cannot get something so small and simple looking to work. Here is all of my testing code, i made it fairly small and simple for the test:
This is all of the code that creates the dll:
----------------------------------------------------------------------------
DLL compiled name is COne.dll, vbproject name One.vbp, class name COne.cls:
Public Function OneOne(pOne, pTwo)
OneOne = pOne + pTwo
End Function
----------------------------------------------------------------------------
Here is all of the code of the .exe that tries to use the dll:
---------------------------------------------------------------------------
Option Explicit
Private Declare Function OneOne Lib "COne.dll" (pOne, pTwo) As Variant
Private Sub cmdDLL_Click()
Dim pOne, pTwo, px
pOne = 1
pTwo = 2
px = OneOne(pOne, pTwo)
MsgBox px
End Sub
--------------------------------------------------------------------------
I've tried many combinations of the Declare statement. I've written out the path to the location of the dll and spent many many hours trying to get this test code to work. Is there something else I need to do?
I got it working when I used the DLL as an object but I really wish to know how to use a dll with a declare function, I never know when I may need it.
Thank you,
Alder