I've been playing with the Mixer API nowadays and try to call it from .NET as well. I found many on the web the following struct definition to call mixerGetDevCapsA
public struct MIXERCAPS
{
public int wMid;
public int wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXPNAMELEN)]
public string szPname;
public int fdwSupport;
public int cDestinations;
}
but when I checked out the results returned I quickly realized that it is not correct and fields are all mixed up, so I created one where the offsets for fields specified as well:
public static extern int mixerGetDevCaps(int uMxId, ref MIXERCAPS
pmxcaps, int cbmxcaps);
[StructLayout(LayoutKind.Explicit)]
public struct MIXERCAPS
{
[FieldOffset(0)]
public short wMid;
[FieldOffset(2)]
public short wPid;
[FieldOffset(4)]
public int vDriverVersion;
[FieldOffset(8)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXPNAMELEN)]
public string szPname;
[FieldOffset(8 + MAXPNAMELEN)]
public int fdwSupport;
[FieldOffset(8 + MAXPNAMELEN + 4)]
public int cDestinations;
};