shrecognizegesture (aygshell)
Last changed: mi.aebi@gmail.com-80.254.166.137

.
Summary
Recognize tap-and-hold on Pocket PC

C# Signature:

[DllImport("aygshell.dll")]
static extern uint SHRecognizeGesture(ref SHRGINFO shrg);

VB .NET Signature:

Declare Function SHRecognizeGesture Lib "aygshell.dll" (shrg As SHRGINFO) As Integer

User-Defined Types:

[StructLayout(LayoutKind.Sequential)]
class SHRGINFO
{
   public uint cbSize = 0;
   public IntPtr hwndClient = IntPtr.Zero;
   public int x = 0; // POINT
   public int y = 0; // POINT
   public uint dwFlags = 0;
}

Constants:

const uint GN_CONTEXTMENU = 1000;
const uint SHRG_RETURNCMD = 0x00000001;
const uint SHRG_NOTIFYPARENT = 0x00000002;
const uint SHRG_LONGDELAY = 0x00000008;
const uint SHRG_NOANIMATION = 0x00000010;

Notes:

None

Tips & Tricks:

Please add some!

Sample Code:

Use this in conjunction with the SetCapture/GetCapture HWND sample:

static bool RecognizeGesture(IntPtr hWnd, int x, int y)
{
   SHRGINFO shrginfo = new SHRGINFO();
   shrginfo.cbSize = (uint)Marshal.SizeOf(shrginfo);
   shrginfo.hwndClient = hWnd;
   shrginfo.x = x;
   shrginfo.y = y;
   shrginfo.dwFlags = SHRG_RETURNCMD;
   return SHRecognizeGesture(ref shrginfo) == GN_CONTEXTMENU;
}

Alternative Managed API:

TODO

Documentation