ok, I want to write a DLL in visual c++ that just returns the numerical value of a position in an array passed into it thru visual basic...
Here is the C++ DLL Code:
---------------------------------------------------------------------------------------------------
Main.CPP
---------------------------------------------------------------------------------------------------
#define WIN32_LEAN_AND_MEAN // No MFC
#include <windows.h> // Standard Windows Include
INT APIENTRY APITest(int imageArray[])
{
int test = imageArray[4];
return test;
}
---------------------------------------------------------------------------------------------------
definitions.def
---------------------------------------------------------------------------------------------------
EXPORTS
APITest @1
Here is the visual basic code:
Private Declare Function TestMyDll Lib "vbdll.dll" Alias "APITest" (ByRef array2() As Integer) As Long
Private Sub Command1_Click()
On Error Resume Next
Dim x As Integer
Dim a(10) As Integer
For x = 0 To 10
a(x) = x
Next x
x = TestMyDll(a())
msgbox x
End Sub
Whenever I click command1, it either msgboxes "0" or a really big number like "25034745"
I am a beginner at this so I am probably not passing the array right or something...
Any ideas?
Thanks.
Here is the C++ DLL Code:
---------------------------------------------------------------------------------------------------
Main.CPP
---------------------------------------------------------------------------------------------------
#define WIN32_LEAN_AND_MEAN // No MFC
#include <windows.h> // Standard Windows Include
INT APIENTRY APITest(int imageArray[])
{
int test = imageArray[4];
return test;
}
---------------------------------------------------------------------------------------------------
definitions.def
---------------------------------------------------------------------------------------------------
EXPORTS
APITest @1
Here is the visual basic code:
Private Declare Function TestMyDll Lib "vbdll.dll" Alias "APITest" (ByRef array2() As Integer) As Long
Private Sub Command1_Click()
On Error Resume Next
Dim x As Integer
Dim a(10) As Integer
For x = 0 To 10
a(x) = x
Next x
x = TestMyDll(a())
msgbox x
End Sub
Whenever I click command1, it either msgboxes "0" or a really big number like "25034745"
I am a beginner at this so I am probably not passing the array right or something...
Any ideas?
Thanks.
