How to pass a byte array from VB to C++ DLL
Posted: Thu Nov 24, 2011 10:04 pm
Define the C++ DLL function as below.
Now declare the function in VB6 as below.
Here is how you need to call it.
Code: Select all
int __stdcall MyFunc(char *buf, long length);
Code: Select all
Declare Function MyFunc(ByVal buf as Long, ByVal len As Long) As Long
Code: Select all
Dim buf(1023) as Byte ' 1024 element array
MyFunc VarPtr(buf(0)), 1024