G
Guest
In VB6, the code for a structure is
Structure zFuheader
Dim Id1(80) As Byte
Dim Id2(80) As Byte
End Structure
However, in .NET, it doesn't let you declare the array size in the
structure.
I am trying to use an old external .dll that worked with the VB6 structure
syntax but doesn't appear to be working when I try and do it in .NET.
The problem in a little more detail:
I am using a number of "Declare Function" statments to access the functions
in the .dll. I am getting an error when I try to pass the structure to one
of the functions in the .dll. (Header Pointer is Null or somthing like that).
Module MainMod
Declare Function initFuHeader Lib "mtsadfconv.dll" Alias
"_initFuHeader_VB@4" _ (ByVal zHeader As zFuheader) As Integer
Public Structure zFuheader
Dim Id1() As Byte 'in VB6 declared to size 80
Dim Id2() As Byte 'in VB6 declared to size 80
End Structure
Public Sub Main()
Dim zHead As zFuheader
Dim result As Integer
result = initFuHeader(zHead) '<-- This returns a "result" that Header
Pointer is Null
End Sub
End Module
So I'm wondering if the error is because the structure doesn't declare a
size for the arrays??? If so, does anyone know a work around?
John
Structure zFuheader
Dim Id1(80) As Byte
Dim Id2(80) As Byte
End Structure
However, in .NET, it doesn't let you declare the array size in the
structure.
I am trying to use an old external .dll that worked with the VB6 structure
syntax but doesn't appear to be working when I try and do it in .NET.
The problem in a little more detail:
I am using a number of "Declare Function" statments to access the functions
in the .dll. I am getting an error when I try to pass the structure to one
of the functions in the .dll. (Header Pointer is Null or somthing like that).
Module MainMod
Declare Function initFuHeader Lib "mtsadfconv.dll" Alias
"_initFuHeader_VB@4" _ (ByVal zHeader As zFuheader) As Integer
Public Structure zFuheader
Dim Id1() As Byte 'in VB6 declared to size 80
Dim Id2() As Byte 'in VB6 declared to size 80
End Structure
Public Sub Main()
Dim zHead As zFuheader
Dim result As Integer
result = initFuHeader(zHead) '<-- This returns a "result" that Header
Pointer is Null
End Sub
End Module
So I'm wondering if the error is because the structure doesn't declare a
size for the arrays??? If so, does anyone know a work around?
John