In windows forms control, I have properly configured the touch gesture by using the SetGestureConfig method. It properly configured the touch gesture for the control. For some cases I need to check whether the control is properly enabled the particular touch gesture or not. I try to use the GetGestureConfig method, to check the particular gesture is enabled or not. But this method always returns false value alone. And also I try to get the error message by using the GetLastError() method, but it is always returns the value 0. Please find the code below,
int gestureConfigSize = Marshal.SizeOf(new GESTURECONFIG());
GESTURECONFIG gc = new GESTURECONFIG();
gc.dwID = 0;
gc.dwWant = WindowMessages.GC_ALLGESTURES;
gc.dwBlock = 0;
if (SetGestureConfig(control.Handle, 0, 1, ref gc, gestureConfigSize))
MessageBox.Show("Zoom gesture configured properly");
GESTURECONFIG gc1 = new GESTURECONFIG();
gc1.dwID = 0;
gc1.dwWant = WindowMessages.GC_ALLGESTURES;
gc1.dwBlock = 0;
GESTURECONFIG[] gestures = new GESTURECONFIG[] { gc1 };
bool value = GetGestureConfig(control.Handle, 0, 0, 1, gestures, gestureConfigSize);
if (!value)
{
int errorValue = GetLastError();
}
And please find the Dll import codes below,
[DllImport("Kernel32.dll")]
static extern Int32 GetLastError();
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetGestureConfig(IntPtr hWnd, int dwReserved, int cIDs, [In] [Out] GESTURECONFIG[] pGestureConfig, int cbSize);
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetGestureConfig(IntPtr hWnd, int dwReserved, int cIDs, ref GESTURECONFIG pGestureConfig, int cbSize);
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetGestureConfig(IntPtr hWnd, int dwReserved, int flags, int cIDs, [In] [Out] GESTURECONFIG[] pGestureConfig, int cbSize);
Please suggest how to check the touch gesture is enabled for the control or not by using the GetGestureConfig method.
Thanks.