I Get the following error when running my code.
I'm calling a method declared like this in VB6
Public Function executeImageSaving(camArray() As Boolean, brightArray() As Integer, darkArray() As Integer) As String
I've never called a DLL expecting Arrays yet in VB .Net.
How should I declare the parameters to send, do I need to play with types
I've tried 2 ways of declaring camBools, brightValues, darkValues.
This way
Dim camBools() As Boolean
Dim brightValues() As Integer
Dim darkValues() As Integer
and also this way.
Dim camBools As System.Array
Dim brightValues As System.Array Dim darkValues As System.ArrayDim objApp As LanexDll.LanexObj
Dim resFonction As Integer
Dim camtxt As String Dim cameraResults As String Dim camBools As System.Array Dim brightValues As System.Array Dim darkValues As System.ArraycamBools = System.Array.CreateInstance(
GetType(Boolean), 16)camBools(0) =
TruecamBools(1) =
False.........camBools(15) = False
brightValues = System.Array.CreateInstance(
GetType(Integer), 16)brightValues(0) =
4brightValues(1) = 4
brightValues(15) = 4
darkValues = System.Array.CreateInstance(
GetType(Integer), 16)darkValues(0) = 4
darkValues(1) = 4
darkValues(15) = 4 objApp = New LanexDll.LanexObj()resFonction = objApp.connect(
"10.1.1.201", "login", "N", "C:\Program Files\Lanex\RVC6\Rvc6.exe") If (resFonction = 1) ThenobjApp.saveStatus(
"c:\status.log") End IfobjApp.setUnitDatetime(
"08", "18", "2006", "10", "12", "15", "P")camtxt = objApp.getCameraNames(0)
cameraResults = objApp.executeImageSaving(camBools, brightValues, darkValues)
MsgBox(camtxt)
Thanks

Specified array was not of the expected type. Calling VB6 DLL
dseifert
GoDaddy
What error are you getting
Take a look at whether you need to pass byref or byval...default for VB6 is byref...default for .NET is byVal...
also....the integer precision is different in VB6 and .NET...
tiffeyneohelp
Anton Papst
At this line
cameraResults = objApp.executeImageSaving(camBools, brightValues, darkValues)
I get the following error.
SafeArrayTypeMismatchException was unhandled -- > Specified array was not of the expected type.
Here's how the function prototype is in VB .Net.
Function executeImageSaving(ByRef camArray As
System.Array, ByRef brightArray As System.Array, ByRef darkArray As System.Array) As StringMember of:
LanexDll.LanexObj._LanexObjhipswich
I've declared them as Short, and it just went through.
Thanks