Hi,
first: due to VB6, when working with UD-Types and API-functions, never use Len, but use LenB instead.
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
|
Private Type myType
a As Integer
s As String
d As Double
End Type
Private Sub Command1_Click()
Dim mt As myType
'MsgBox Len(myType) & " " & Len(mt)
MsgBox Len(mt) & " " & LenB(mt)
End Sub
|
As you may know, the reason for that is: padding bytes
but you got to keep calm, normally all UD-Types concerning the win-API have a 4-byte alignment.
by the way: additional tipp: VB is able to deal with 1,2 and 4-byte-alignment, so packed records are also possible in VB, just use a typelibrary for your udtypes. In VB-modules only 4-byte aligned udtype-records will be produced by VB itself. Google search: "ActiveVB UDTypeAlignment.zip"
second: it's only for completeness reasons: there was a similar thread to this questions started by StefanSchnell :
Size of a structure
he also posted a solution for that kind of problems, togehter with his VarPtr.dll
third: All of this is not the answer to the JNA-questions. But we got to ask Manuel how the native-keyword is meant to be.
@Manuel, ho is the new native-keyword in conjunction with the new class-property ment to be used?
Is it maybe the way or even half the way to JNA?
regards
OlimilO