Esempio n. 1
0
        private static bool OnMouseInputReceived(WinAPI.WM wm, WinAPI.WindowHook.MSLLHOOKSTRUCT hookStruct)
        {
            // ignore injected input
            if (hookStruct.flags.HasFlag(WinAPI.WindowHook.LLMHF.INJECTED))
            {
                return(false);
            }

            MouseInput mouseInputEventArgs = MouseInput.CreateFrom(wm, hookStruct);

            if (Performance.IsPerformanceEnabled)
            {
                MouseInputPerformance.Count(Convert.ToInt64(mouseInputEventArgs.Time));
            }
            try
            {
                if (MouseInputReceived != null)
                {
                    MouseInputReceived(null, mouseInputEventArgs);
                    return(mouseInputEventArgs.Handled);
                }
            }
            catch (Exception ex)
            {
                ex.Log();
            }
            return(false);
        }
Esempio n. 2
0
        private static bool OnMouseInputReceived(Win32.WM wParam, Win32.WindowHook.MSLLHOOKSTRUCT hookStruct)
        {
            if (Win32.WindowHook.LLMHF.INJECTED == (hookStruct.flags & Win32.WindowHook.LLMHF.INJECTED))
            {
                return(false);
            }

            MouseInput mouseInputEventArgs = MouseInput.CreateFrom((Win32.WM)wParam, hookStruct);

            mouseInputEventArgs.WM = wParam;
            if (Performance.IsPerformanceEnabled)
            {
                MouseInputPerformance.Count(Convert.ToInt64(mouseInputEventArgs.Time));
            }
            try
            {
                if (MouseInputReceived != null)
                {
                    MouseInputReceived(mouseInputEventArgs);
                    return(mouseInputEventArgs.Handled);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
            return(false);
        }