Ejemplo n.º 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));
        }
        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));
        }
        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));
        }