protected override int HookCallbackProcedure(int nCode, int wParam, IntPtr lParam) { if (nCode > -1 && (this.MouseDown != null || this.MouseUp != null || this.MouseMove != null)) { GlobalHook.MouseLLHookStruct mouseLLHookStruct = (GlobalHook.MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(GlobalHook.MouseLLHookStruct)); MouseButtons button = this.GetButton(wParam); MouseHook.MouseEventType mouseEventType = this.GetEventType(wParam); MouseEventArgs e = new MouseEventArgs(button, (mouseEventType == MouseHook.MouseEventType.DoubleClick) ? 2 : 1, mouseLLHookStruct.pt.x, mouseLLHookStruct.pt.y, (int)((mouseEventType == MouseHook.MouseEventType.MouseWheel) ? ((short)(mouseLLHookStruct.mouseData >> 16 & 65535)) : 0)); if (button == MouseButtons.Right && mouseLLHookStruct.flags != 0) { mouseEventType = MouseHook.MouseEventType.None; } switch (mouseEventType) { case MouseHook.MouseEventType.MouseDown: if (this.MouseDown != null) { this.MouseDown(this, e); } break; case MouseHook.MouseEventType.MouseUp: if (this.Click != null) { this.Click(this, new EventArgs()); } if (this.MouseUp != null) { this.MouseUp(this, e); } break; case MouseHook.MouseEventType.DoubleClick: if (this.DoubleClick != null) { this.DoubleClick(this, new EventArgs()); } break; case MouseHook.MouseEventType.MouseWheel: if (this.MouseWheel != null) { this.MouseWheel(this, e); } break; case MouseHook.MouseEventType.MouseMove: if (this.MouseMove != null) { this.MouseMove(this, e); } break; } } return(GlobalHook.CallNextHookEx(this._handleToHook, nCode, wParam, lParam)); }
protected override int HookCallbackProcedure(int nCode, int wParam, IntPtr lParam) { if (this.ScreenMsg) { return(-1); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field if (nCode > -1 && (this.MouseDown != null || this.MouseUp != null || this.MouseMove != null)) { GlobalHook.MouseLLHookStruct mouseLlHookStruct = (GlobalHook.MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(GlobalHook.MouseLLHookStruct)); int num1 = (int)this.GetButton(wParam); MouseHook.MouseEventType mouseEventType = this.GetEventType(wParam); int clicks = mouseEventType == MouseHook.MouseEventType.DoubleClick ? 2 : 1; int x = mouseLlHookStruct.pt.x; int y = mouseLlHookStruct.pt.y; int delta = mouseEventType == MouseHook.MouseEventType.MouseWheel ? (int)(short)(mouseLlHookStruct.mouseData >> 16 & (int)ushort.MaxValue) : 0; MouseEventArgs e = new MouseEventArgs((MouseButtons)num1, clicks, x, y, delta); int num2 = 2097152; if (num1 == num2 && mouseLlHookStruct.flags != 0) { mouseEventType = MouseHook.MouseEventType.None; } switch (mouseEventType) { case MouseHook.MouseEventType.MouseDown: // ISSUE: reference to a compiler-generated field if (this.MouseDown != null) { // ISSUE: reference to a compiler-generated field this.MouseDown((object)this, e); break; } break; case MouseHook.MouseEventType.MouseUp: // ISSUE: reference to a compiler-generated field if (this.Click != null) { // ISSUE: reference to a compiler-generated field this.Click((object)this, new EventArgs()); } // ISSUE: reference to a compiler-generated field if (this.MouseUp != null) { // ISSUE: reference to a compiler-generated field this.MouseUp((object)this, e); break; } break; case MouseHook.MouseEventType.DoubleClick: // ISSUE: reference to a compiler-generated field if (this.DoubleClick != null) { // ISSUE: reference to a compiler-generated field this.DoubleClick((object)this, new EventArgs()); break; } break; case MouseHook.MouseEventType.MouseWheel: // ISSUE: reference to a compiler-generated field if (this.MouseWheel != null) { // ISSUE: reference to a compiler-generated field this.MouseWheel((object)this, e); break; } break; case MouseHook.MouseEventType.MouseMove: // ISSUE: reference to a compiler-generated field if (this.MouseMove != null) { // ISSUE: reference to a compiler-generated field this.MouseMove((object)this, e); break; } break; } } return(GlobalHook.CallNextHookEx(this._handleToHook, nCode, wParam, lParam)); }