Compartilhar via


WM_GESTURE (Compact 2013)

3/28/2014

The gesture engine posts this message to a window procedure to indicate that a gesture has occurred or is in progress.

Parameters

  • wParam
    ID of the gesture command.
  • lParam
    HGESTUREINFO handle to the gesture information.

Return Value

If the application processes the gesture, then it returns a nonzero value. If the application does not process the gesture, it must pass the message to DefWindowProc.

Remarks

You can use the gesture ID to determine whether you want to handle the gesture or you want DefWindowProc to handle the gesture. If the window procedure handles the gesture, you can call GetGestureInfo to obtain more information about the gesture. If you process the gesture, you must not pass the message to the default window procedure. You can call GetGestureInfo to obtain a GESTUREINFO structure that contains more information about the gesture.

Forwarding Gesture Messages

The WM_GESTURE message is posted asynchronously by the Gesture function. You can use PostMessage, SendMessage, or a variant to forward the message to another message queue.

Important

An unhandled WM_GESTURE message that the window procedure passes to DefWindowProc is propagated to the parent window, if a parent window exists. If an application passes gesture messages to a child window, and the child window does not handle them, a stack recursion error occurs as the message is repeatedly bounced between the parent and child.

The application creates an HGESTUREINFO handle immediately before the WindowProc is called. An application cannot save the HGESTUREINFO handle for later use. The lParam value of WM_GESTURE is meaningless outside the window process, as the HGESTUREINFO handle does not become valid until DispatchMessage delivers the message to the window process.

Examples

The following code sample shows how you can add handling for a select gesture:

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

case WM_GESTURE: 
{
  HGESTUREINFO hgi = reinterpert_cast<HGESTUREINFO>(lParam);
  If (GID_SELECT == wParam) 
  {
    GESTUREINFO gi;

    // Populate the GESTUREINFO structure with information about the gesture.
    gi.cbSize = sizeof(GESTUREINFO);
    if (GetGestureInfo(hgi, &gi)) 
    {
      // Call a function to process the Select gesture
      ProcessSelect(*gi);
    }
    return 1;
  }
  // Fall through to DefWindowProc
  break;
}

Requirements

Header

winuser.h

sysgen

SYSGEN_TOUCHGESTURE

See Also

Reference

Gesture Messages