Hello, I'm trying to write a simple application that listens for WM_gesture messages in c# but don't have the PDC examples. I have got as far as (important snippets):

[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetGestureInfo(System.IntPtr hGestureInfo, [Out] GESTUREINFO pGestureInfo);

private struct GESTUREINFO
public int cbSize;
public int dwFlags;
public int dwID;
public System.IntPtr hwndTarget;
public POINTS ptsLocation;
public int dwInstanceID;
public int dwSequenceID;
public ulong ullArguments;
public int cbExtraArgs;}

gi.cbSize = Marshal.SizeOf(gi);
gi.dwFlags = 0;
gi.ptsLocation.x = 0;
gi.ptsLocation.y = 0;
gi.dwID = 0;
gi.dwInstanceID = 0;
gi.dwSequenceID = 0;

bResult = GetGestureInfo(m.LParam, gi);
catch (Exception)

But always get:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
on the GetgestureInfo call

Anyone have any advice?

(Running Dell XT & ntrig multitouch driver on Win7 public beta)