コード例 #1
0
        private IntPtr MouseHookDelegate(Int32 Code, IntPtr wParam, IntPtr lParam)
        {
            mainForm.lastInputTime = Environment.TickCount;

            mainForm.currentNotificationTimeIndex = 0;

            if (mainForm.checkBox9.Checked)
            {
                if (mainForm.recordingSeries1)
                {
                    /*////mainForm.series1BinData.numberOfFrames += mainForm.bufferFrames.AddBufferRangeIntoArray(mainForm.bufferFrames.bufferFramesArray, mainForm.series1BinData.totalBinArray, Mode.Far);
                     * mainForm.series1BinData.bufferFrames = 0;
                     */

                    ////mainForm.RecordSeries1();
                    mainForm.recordingSeries2 = true;
                    mainForm.recordingSeries1 = false;

                    mainForm.transitionBufferNearIndex = mainForm.bufferFrames.currentBufferIndex;


                    ////mainForm.RecordSeries2();
                }
                else if (mainForm.recordingSeries2 && mainForm.recordingIntoBuffer)
                {
                    ////mainForm.bufferFrames.Change(Mode.Indeterminate, Mode.Near);
                }
            }

            WindowsHookHelper.UnhookWindowsHookEx(mouseHandle);

            mouseHandle = WindowsHookHelper.SetWindowsHookEx(WH_MOUSE_LL, mouseDelegate, IntPtr.Zero, 0);

            return(WindowsHookHelper.CallNextHookEx(mouseHandle, Code, wParam, lParam));
        }
コード例 #2
0
        private IntPtr MouseHookDelegate(Int32 Code, IntPtr wParam, IntPtr lParam)
        {
            GUIInput.lastInputTime = (Environment.TickCount & int.MaxValue);

            Notifications.currentNotificationTimeIndex = 0;

            hookStruct = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));

            currentCoord.X = hookStruct.pt.x;
            currentCoord.Y = hookStruct.pt.y;

            mouseCoords.Add(new MouseCoord(currentCoord, GUIInput.lastInputTime));

            if (prevCoord.X == 0 && prevCoord.Y == 0)
            {
                prevCoord = currentCoord;
            }

            double distance = this.GetMovementOverTime(1000);

            if (distance > 100 || (Int32)wParam != GUIInput.WM_MOUSEMOVE)
            {
                mainForm.CheckForStartRecordingNearSeries();
            }

            prevCoord.X = currentCoord.X;
            prevCoord.Y = currentCoord.Y;

            WindowsHookHelper.UnhookWindowsHookEx(mouseHandle);

            mouseHandle = WindowsHookHelper.SetWindowsHookEx(WH_MOUSE_LL, mouseDelegate, IntPtr.Zero, 0);

            return(WindowsHookHelper.CallNextHookEx(mouseHandle, Code, wParam, lParam));
        }
コード例 #3
0
        public KeyboardInput(Form1 mainForm)
        {
            this.mainForm = mainForm;

            keyBoardDelegate = KeyboardHookDelegate;

            keyBoardHandle = WindowsHookHelper.SetWindowsHookEx(WH_KEYBOARD_LL, keyBoardDelegate, IntPtr.Zero, 0);
        }
コード例 #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (mouseHandle != IntPtr.Zero)
                {
                    WindowsHookHelper.UnhookWindowsHookEx(mouseHandle);
                }

                disposed = true;
            }
        }
コード例 #5
0
        private IntPtr KeyboardHookDelegate(Int32 Code, IntPtr wParam, IntPtr lParam)
        {
            GUIInput.lastInputTime = (Environment.TickCount & int.MaxValue);

            Notifications.currentNotificationTimeIndex = 0;

            if (mainForm.UsingProximitryDetection())
            {
                mainForm.CheckForStartRecordingNearSeries();
            }

            WindowsHookHelper.UnhookWindowsHookEx(keyBoardHandle);

            keyBoardHandle = WindowsHookHelper.SetWindowsHookEx(WH_KEYBOARD_LL, keyBoardDelegate, IntPtr.Zero, 0);

            return(WindowsHookHelper.CallNextHookEx(keyBoardHandle, Code, wParam, lParam));
        }
コード例 #6
0
 public MouseInput(Form1 mainForm)
 {
     this.mainForm = mainForm;
     mouseDelegate = MouseHookDelegate;
     mouseHandle   = WindowsHookHelper.SetWindowsHookEx(WH_MOUSE_LL, mouseDelegate, IntPtr.Zero, 0);
 }