Problems accessing Pen Flicks - Access Violation RRS feed

  • Question

  • Hi,

    I'm trying to write C# code that responds to the WM_TABLET_FLICK messages in a WinForm app.  I override the WndProc.  I can see the WM_TABLET_FLICK messages.  But when I attempt to get the FLICK_POINT struct from the LParam, I'm getting an Access Violation - attempted to read or write protected memory.

    I'm using FLICK_POINT flkPoint = (FLICK_POINT)msg.GetLParam(typeof(FLICK_POINT));

    I've got FLICK_POINT struct defined as:

    public struct FLICK_POINT
        public Int16 x;
        public Int16 y;

    I'm running this on HP TouchSmart tx2 tablet PC with Vista 32bit.

    Anyone have similar problems with this?  Any thoughts/suggestions would be appreciated?


    Thursday, March 12, 2009 9:34 PM


  • I found the answer.  The LParam is not really a pointer, it is the actual flick point.  Because I was trying to use the integer like it was pointing to a structure in memory, I was getting the access violation.  Once I cast the IntPtr to an Int32, then it all started working correctly.  I found out that the upper 16 bits or hi word is the Y coordinate and the lower 16 bits or lo word is the X coordinate.  Hope this is helpful to anyone else trying to do this.
    • Marked as answer by therobotgeek Tuesday, May 12, 2009 6:02 PM
    Saturday, March 14, 2009 2:38 AM