I am attempting to call a function on the RightFax API from VB.NET. The
original declaration for the function in VB 6.0 is:
Declare Function RFVB_SendFiles1 Lib "RF2VB.DLL" (ByVal hServer As Long, _
ByVal lFI10Object As Long, _
ByVal lNI10Object As Long, _
ByVal fSendWithCover As
Boolean, _
sCoverSheetModel As
String, _
aFiles() As String, _
hNewFax As Long) As Long
When translated to VB.NET the declaration looks like:
Declare Function RFVB_SendFiles1 Lib "RF2VB.DLL" (ByVal hServer As Integer, _
ByVal lFI10Object As Integer, _
ByVal lNI10Object As Integer, _
ByVal fSendWithCover As Boolean, _
ByRef sCoverSheetModel As String, _
ByRef aFiles() As String, _
ByRef hNewFax As Integer) As Integer
I call the function with the line:
lError = RFVB_SendFiles1(hServer, lFI10Obj, lNI10Obj, 1, "", aFiles, lHandle)
where:
· hServer is an integer
· lFI10Obj is an integer
· lNI10Obj is an integer
· aFiles is a string array of 8 elements with only the first element set to
a value.
· lHandle is an integer
Whenever I hit the call I get an error message back from the DLL about an
invalid parameter. Could I be violating a word boundary or not initializing
the string array correctly? I’m stumped.
Steve Miller
AllTech Inc.
swmiller@rocketmail.com
Eric Carlson - 10 Dec 2004 21:55 GMT
Did you try passing your string array byval instead of byref ?
Steve Miller - 10 Dec 2004 22:45 GMT
Yes, I got the same error message.
> Did you try passing your string array byval instead of byref ?
Eric Carlson - 12 Dec 2004 06:17 GMT
Okay, i think you are correct when you pass the string array as value (from
what i have read)
Your problem might be with the boolean.. i think that booleans are
represented differently from vb6 to vb.net. You might try using the marshal
boolean attribute on that paremter... or setting up the parameter as the
correct size data type (i.e. "short" or whatever is the correct data size for
vb6 boolean).
Just some ideas....