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(SHRGINFO shrg);

VB .NET Signature:

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

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

const uint GN_CONTEXTMENU = 1000;
const uint SHRG_RETURNCMD = 0x00000001;

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(shrginfo) == GN_CONTEXTMENU;
}

Alternative Managed API:

TODO

Documentation