If you need to pass one managed structure to unmanaged code you could do it like in the foollowing example (taken from:
MSDN[
^]):
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct Point {
public int x;
public int y;
}
[StructLayout(LayoutKind.Explicit)]
public struct Rect {
[FieldOffset(0)] public int left;
[FieldOffset(4)] public int top;
[FieldOffset(8)] public int right;
[FieldOffset(12)] public int bottom;
}
class Win32API {
[DllImport("User32.dll")]
public static extern bool PtInRect(ref Rect r, Point p);
}
If you want to pass the array to the unmanaged function this could also help:
MSDN[
^]
For consuming functions from windows APIs
pinvoke.net/[
^] has very usefull resources and sample code you could use.