> rowe_newsgroups wrote:
> > On Oct 4, 4:06 am, Jack Russell <ja...@norubbish.tpg.com.au>
[quoted text clipped - 19 lines]
> Still struggling although have found I can make it work (VB6 needs
> the structures passed by val, .net by ref).
The API function needs them "ByRef", in VB6 as well as in VB.Net. If you
don't specify anything in VB6, it defaults to ByRef.
> However I need the following structure
>
[quoted text clipped - 16 lines]
> structure). The only way I have found is to pad it with integers
> although strangely not to the length that I would have expected!
What's your current VB.Net declaration?
Armin
Jack Russell - 08 Oct 2007 10:07 GMT
>> > On Oct 4, 4:06 am, Jack Russell <ja...@norubbish.tpg.com.au>
>> > wrote:
[quoted text clipped - 21 lines]
> The API function needs them "ByRef", in VB6 as well as in VB.Net. If you
> don't specify anything in VB6, it defaults to ByRef.
I agree with you, it is just that the sample program I found on the net
had them byval and it worked in VB^. Maybe VB6 is cleverer than we thought!
>> However I need the following structure
>>
[quoted text clipped - 20 lines]
>
> Armin
I got it to work after finding this in a sample program (unfortunately I
cannot get Help to tell me what it means).
<StructLayout(LayoutKind.Sequential)> _
Private Structure JOYCAPS
Dim wMid As Int16
Dim wPid As Int16
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
Dim szPname As String ' * MAXPNAMELEN
Dim wXmin As Integer
Dim wXmax As Integer
Dim wYmin As Integer
Dim wYmax As Integer
Dim wZmin As Integer
Dim wZmax As Integer
Dim wNumButtons As Integer
Dim wPeriodMin As Integer
Dim wPeriodMax As Integer
End Structure