I have the following struct:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WAVEHDR { internal IntPtr lpData; // pointer t
2) As far as I know the sizeof can only be used with types that have a predefined size at the compile-time.
sizeof
So use Marshal.SizeOf(typeof(WAVEHDR)).
Marshal.SizeOf(typeof(WAVEHDR))