Exemple #1
0
        public static void test()
        {
            var hook = new WM_TouchHook(IntPtr.Zero, HookType.WH_CALLWNDPROC);

            hook.InstallHook();
            hook.TouchDown += Hook_TouchDown;
        }
        public static void Init()
        {
#if USE_MOUSE_IN_PLACE_OF_TOUCH
            touchHook = new WM_MouseHook(BokuGame.bokuGame.Window.Handle);
#else
            IntPtr mainformHandle   = MainForm.Instance.Handle;
            IntPtr xnaControlHandle = XNAControl.Instance.Handle;
            cwTouchHook = new WM_TouchHook(xnaControlHandle, TouchHook.HookType.WH_CALLWNDPROC);
            //messageTouchHook = new WM_TouchHook(BokuGame.bokuGame.Window.Handle, TouchHook.HookType.WH_GETMESSAGE);
#endif
            WM_TouchHook.DisableNativePressAndHoldGesture = true;
            //messageTouchHook.InstallHook();
            cwTouchHook.InstallHook();

#if USE_MOUSE_IN_PLACE_OF_TOUCH
            touchHook.MouseDown += new EventHandler <MouseEventArgs>(MouseDownHandler);
            touchHook.MouseMove += new EventHandler <MouseEventArgs>(MouseMoveHandler);
            touchHook.MouseUp   += new EventHandler <MouseEventArgs>(MouseUpHandler);
#else
            cwTouchHook.TouchDown += new EventHandler <TouchEventArgs>(TouchDownHandler);
            cwTouchHook.TouchMove += new EventHandler <TouchEventArgs>(TouchMoveHandler);
            cwTouchHook.TouchUp   += new EventHandler <TouchEventArgs>(TouchUpHandler);

            //messageTouchHook.TouchDown += new EventHandler<TouchEventArgs>(TouchDownHandler);
            //messageTouchHook.TouchMove += new EventHandler<TouchEventArgs>(TouchMoveHandler);
            //messageTouchHook.TouchUp += new EventHandler<TouchEventArgs>(TouchUpHandler);

            //store the max touch count detected at startup
            TouchInput.TouchAvailable = cwTouchHook.IsTouchAvailable();
            TouchInput.MaxTouchCount  = cwTouchHook.GetMaxTouches();
#endif
        }
Exemple #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     richTextBox1.Clear();
     proc = Process.GetCurrentProcess();
     //proc = Process.Start($@"C:\Work\Shortcuts\Launch Shantae and the Pirate's Curse.lnk");
     hwnd = proc.MainWindowHandle;
     hook = new WM_TouchHook(hwnd, HookType.WH_GETMESSAGE);
     hook.InstallHook();
     hook.TouchDown += Hook_TouchDown;
 }