Get Gesture Information (Compact 7)
3/12/2014
When a gesture event occurs, GWES sends a gesture message to all the windows that you specified in calls to EnableGestures to enable the gesture type.
You call GetGestureInfo, a function provided by the gesture core, to get information about the event. You pass the handle that is in member lparam of the gesture message, and you pass a pointer to a GESTUREINFO structure. GetGestureInfo places the gesture event information in the structure.
The gesture core API definitions are in Winuser.h. The following code is the definition of GESTUREINFO.
typedef struct tagGESTUREINFO
{
UINT cbSize; /* Initialised to structure size */
DWORD dwFlags; /* Gesture Flags */
DWORD dwID; /* Gesture ID */
HWND hwndTarget; /* HWND of target window */
POINTS ptsLocation; /* Coordinates of start of gesture */
DWORD dwInstanceID; /* Gesture Instance ID */
DWORD dwSequenceID; /* Gesture Sequence ID */
ULONGLONG ullArguments; /* Arguments specific to gesture */
UINT cbExtraArguments; /* Size of extra arguments in bytes */
} GESTUREINFO, * PGESTUREINFO;
Member dwFlags is a bitmap that holds gesture flags. The following table shows the flags and their meanings.
Flag | Meaning when flag is set |
---|---|
GF_BEGIN |
The gesture started. |
GF_INERTIA |
A pan gesture has transitioned to a flick gesture. |
GF_END |
The gesture ended. |
GF_SYMMETRIC |
The gesture is a two-finger gesture from a symmetric panel. |
For a tap (select) gesture, both GF_BEGIN and GF_END are set.
Member dwID provides the gesture type. The following table describes the gesture types.
Gesture type | Description |
---|---|
GID_BEGIN |
The user began a touch gesture by touching the screen. |
GID_END |
The user ended a gesture by removing his finger from the screen. |
GID_PAN |
The user touched the screen (generating an earlier GID_BEGIN event) and moved his finger. |
GID_ROTATE |
Reserved. |
GID_SCROLL |
The user touched the screen, moved his finger quickly, and lifted it. This gesture is often called a flick. |
GID_HOLD |
The user touched the screen and held it there for longer than the hold time-out period. A hold corresponds to a mouse right-click. |
GID_SELECT |
The user touched the screen and held it there for shorter than the hold time-out period. This gesture is often called a tap. |
GID_DOUBLESELECT |
The user tapped two times on the screen in less time than the hold time-out. This gesture is often called a double-tap, and corresponds to a double-click of the left mouse key. |
GID_DIRECTMANIPULATION |
The user touched the screen and moved his finger. When direct manipulation is enabled, pan is disabled. Therefore, this gesture cannot be interpreted as a pan. |
For more information about the gesture types, see Gesture Commands.
Some other notable members of GETGESTUREINFO are provided here.
- ptsLocation
Provides a touch location. For single touch, it holds the coordinates of the contact point. For multi-touch, the meaning depends on the gesture type. For multi-touch pan, it is the middle point of the two touch points. For multi-touch direct manipulation and pan, it is the primary touch point.
- ullArguments
Contains additional information associated with the gesture type. For a pan, this field contains the pan movement deltas. For a flick gesture, this field contains the direction, angle and velocity of the flick.
- dbExtraArguments
The member can provide information for gesture events from custom recognizers. The built-in recognizer does not use it.
For more information about the GESTUREINFO structure, see GESTUREINFO.