SHRecognizeGesture
This function is used to recognize pauses in stylus movement.
WINSHELLAPI DWORD SHRecognizeGesture(
SHRGINFO* shrg
);
Parameters
- shrg
[in] Pointer to a SHRGINFO structure.
Return Values
If there was a context menu gesture, then one of the following will be returned:
- If shrg.dwFlags is SHRG_RETURNCMD, the function will return GN_CONTEXTMENU.
- If shrg.dwFlags is SHRG_NOTIFYPARENT, a WM_NOTIFY message with GN_CONTEXTMENU set will be sent to the parent of shrg->hwndClient. The function will return the return value that came from processing the WM_NOTIFY message.
- If shrg.dwFlags is SHRG_LONGDELAY, a WM_NOTIFY message with GN_CONTEXTMENU set will be sent to shrg->hwndClient, and the function will return the return value that came from processing the WM_NOTIFY message.
This function returns 0 if there was no context menu gesture.
Remarks
The currently supported gesture is for context menus, where a context menu gesture is defined as when the user presses and holds the stylus in the same spot for some short period of time. This amount of time can be controlled by the OEM through a registry setting. For more information, see Common Control Registry Settings.
Typically, a control will call this function during the WM_LBUTTONDOWN processing. If the user presses and holds long enough to warrant a context menu, a GN_CONTEXTMENU notification will be returned by the function, or sent to the parent of the control, depending on the values in the SHRGINFO structure.
It is the responsibility of the application processing the GN_CONTEXTMENU notification to bring up the menu.
If you do not want to provide the standard animation feedback for a tap-and-hold gesture, set the SHRG_NOANIMATION flag when calling the SHRecognizeGesture function. The following code example shows this setting.
case WM_LBUTTONDOWN:
{
SHRGINFO shrg;
HMENU hmenu;
shrg.cbSize = sizeof(shrg);
shrg.hwndClient = hWnd;
shrg.ptDown.x = LOWORD(lParam);
shrg.ptDown.y = HIWORD(lParam);
shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU) {
hmenu = GetSubMenu(g_hMainMenu, 0);
TrackPopupMenuEx(hmenu,
TPM_LEFTALIGN,
LOWORD(lParam),
HIWORD(lParam),
hWnd,
NULL);
}
break;
}
Requirements
OS Versions: Windows CE .NET 4.2 and later.
Header: Aygshell.h.
Link Library: Aygshell.lib.
See Also
AYGShell Functions | SHRGINFO | WM_NOTIFY | WM_LBUTTONDOWN | Shell Registry Settings | Common Control Registry Settings
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.