In window shape management, I set the touch gesture correctly using the SetGestureConfig method. He correctly configured the touch gesture for the control. In some cases, I need to check if the control for the special touch gesture is turned on correctly or not. I am trying to use the GetGestureConfig method to check which particular gesture is enabled or not. But this method always returns false . And also I'm trying to get an error message using the GetLastError () method, but it always returns 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 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 for control or not using the GetGestureConfig method.
Thanks.
source share