public RawMouseEventArgs(int x, int y, int data, uint flags) { this.x = InterceptMouse.CalculateAbsoluteCoordinateX(x); this.y = InterceptMouse.CalculateAbsoluteCoordinateY(y); this.data = data; this.flags = flags; }
public MouseListener() { hookedLowLevelMouseProc = (InterceptMouse.LowLevelMouseProc)LowLevelMouseProc; hookId = InterceptMouse.SetHook(hookedLowLevelMouseProc); hookedMouseCallbackAsync = new MouseCallbackAsync(MouseListener_MouseCallbackAsync); }
private IntPtr LowLevelMouseProc(int nCode, UIntPtr wParam, IntPtr lParam) { if (nCode >= 0) { if (wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_LBUTTONDOWN || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_LBUTTONUP || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_MOUSEMOVE || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_MOUSEWHEEL || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_RBUTTONDOWN || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_RBUTTONUP) { hookedMouseCallbackAsync.BeginInvoke((InterceptMouse.MouseMessages)wParam.ToUInt32(), (InterceptMouse.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(InterceptMouse.MSLLHOOKSTRUCT)), null, null); } } if (wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_LBUTTONDOWN || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_LBUTTONUP || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_MOUSEWHEEL || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_RBUTTONDOWN || wParam.ToUInt32() == (int)InterceptMouse.MouseMessages.WM_RBUTTONUP) { return(new IntPtr(1)); } return(InterceptMouse.CallNextHookEx(hookId, nCode, wParam, lParam)); }
public void Dispose() { InterceptMouse.UnhookWindowsHookEx(hookId); }