Tech Off Thread

4 posts

WM_GESTURECOMMAND on Windows 7

Back to Forum: Tech Off
  • jpkleinau

    I am using Windows 7 PreBeta (Build 6801) on a HP TouchSmart IQ810 System. I try to use the multi-touch functionality and the gestures, but I don't get any WM_GESTURECOMMAND messages.

     

    I get the WM_TOUCH messages, but only for one finger (no multitouch). The current multi touch driver (NextWindow V1.0.3.4) is installed.

     

    I need some help. Is there anything I am doing wrong?



    Here is my Test app code:

     

        public partial class Form1 : Form

        {

            [DllImport("user32", EntryPoint = "RegisterGestureHandlerWindow")]

            public static extern int RegisterGestureHandlerWindow(IntPtr hwnd, uint flags);

     

            [DllImport("user32", EntryPoint = "RegisterTouchWindow")]

            public static extern int RegisterTouchWindow(IntPtr hwnd, uint flags);

     

            public Form1()

            {

                InitializeComponent();

                 RegisterTouchWindow(Handle, 0);

                RegisterGestureHandlerWindow(Handle, 0);    

            }

     

            protected override void WndProc(ref Message m)

            {

                switch (m.Msg)

                {

                    // WM_GESTURECOMMAND

                    case 0x0119:

                        Trace.WriteLine("Gesture");

                        break;

     

                    // WM_TOUCHDOWN

                    case 0x0241:

                        Trace.WriteLine("TouchDown");

                        break;

     

                    // WM_TOUCHUP

                    case 0x0242:

                        Trace.WriteLine("TouchUp");

                        break;

                 }

                base.WndProc(ref m);

            }

       }

     

  • jh71283

    You may already know it, but the hardware has to explicitly support multitouch also.

    Most touchscreens are single touch at the moment.

  • jpkleinau

    jh71283 said:
    You may already know it, but the hardware has to explicitly support multitouch also.

    Most touchscreens are single touch at the moment.
    I do know. And I do now know the reason why. the multitouch is blocked in the 6801 Build. There is an unlock patch for 32bit at Rafael Rivera's Blog Within Windows. Use it at your own risk Wink

  • gillsr

    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):

    [DllImport("user32")]
    [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;}

    GESTUREINFO gi = new GESTUREINFO();
    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;

    try
    {
    bResult = GetGestureInfo(m.LParam, gi);
    }
    catch (Exception)
    {
    throw;
    }

    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)

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.