How to Prevent Tap-and-Hold Animation Display

4/19/2010

If you do not want to provide the standard animation feedback for a tap-and-hold gesture for your application, you can set the SHRG_NOANIMATION flag when calling the SHRecognizeGesture function, as shown in the following example message handler for WM_LBUTTONDOWN.

Code Example

The following code example demonstrates how to use prevent tap-and-hold animation display.

Note

To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.

    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 | ;

        if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU) {
            hmenu = GetSubMenu(g_hMainMenu, 0);
            TrackPopupMenuEx(hmenu, TPM_LEFTALIGN, LOWORD(lParam),
                             HIWORD(lParam), hWnd, NULL);
        }
        break;
    }

See Also

Concepts

How to Display a Shortcut Menu from an Existing Resource
Menu Overview

Other Resources

Developing Menu Components