I can't test it, but this should be the straightforward conversion:
Private Const MAXPNAMELEN As Integer = 32
<StructLayout(LayoutKind.Sequential)>
Private Structure JOYCAPS
Public wMid As Short
Public wPid As Short
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAXPNAMELEN)>
Public szPname As String
Public wXmin As Integer
Public wXmax As Integer
Public wYmin As Integer
Public wYmax As Integer
Public wZmin As Integer
Public wZmax As Integer
Public wNumButtons As Integer
Public wPeriodMin As Integer
Public wPeriodMax As Integer
End Structure
<DllImport("winmm.dll")>
Private Shared Function joyGetDevCaps(id As IntPtr, ByRef lpCaps As JOYCAPS, uSize As UInteger) As Integer
End Function
It assumes System.Runtime.InteropServices
is imported.