private void DetectDoubleClick(MouseEventType type, Native.PointW point) { var deltaMs = DateTime.Now - _lastClickTime; _lastClickTime = DateTime.Now; if (deltaMs.TotalMilliseconds <= Native.GetDoubleClickTime()) { _clickCount++; } else { _clickCount = 1; } if (_clickCount != 2) { return; } OnMouseActivity?.Invoke(this, new SimpleMouseGesture(type, point.X, point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); _clickCount = 0; }
void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { string output = outLine.Data; Console.WriteLine(output); if (output == "hookFailed") { processMonitor.Kill(); processMonitor.Close(); processMonitor = null; throw new Exception("注册键鼠钩子失败!"); } else if (output == "KeyboardAction") { onKeyboardActivity?.Invoke(this); } else { if (output != null) { string[] res = output.Split(' '); if (res.Length == 3) { POINT pt = new POINT() { x = int.Parse(res[1]), y = int.Parse(res[2]) }; OnMouseActivity?.Invoke(this, pt); } } } }
/// <summary> /// A callback function which will be called every time a mouse activity detected. /// https://docs.microsoft.com/en-us/windows/win32/winmsg/lowlevelmouseproc /// </summary> /// <param name="code"> /// Specifies whether the hook procedure must process the message. /// If code is HC_ACTION, the hook procedure must process the message. /// If code is less than zero, the hook procedure must pass the message to the /// CallNextHookEx function without further processing and must return the value returned by CallNextHookEx. /// </param> /// <param name="type"> /// Same as wParam. Specifies whether the message was sent by the current thread. /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero. /// </param> /// <param name="structure"> /// Same as lParam. Pointer to a CWPSTRUCT structure that contains details about the message. /// </param> /// <returns> /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx. /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook /// procedure does not call CallNextHookEx, the return value should be zero. /// </returns> private IntPtr MouseHookProc(int code, uint type, IntPtr structure) { //If it's not Ok or no one listens to this event, call next hook. if (code < 0 || OnMouseActivity == null) { return(CallNextHookEx(_mouseHookHandle, code, type, structure)); } //Marshall the data from callback. var mouse = (MouseHookStruct)Marshal.PtrToStructure(structure, typeof(MouseHookStruct)); var data = new WordLevel.WordUnion { Number = mouse.MouseData }; #region Mouse actions switch ((MouseEventType)type) { case MouseEventType.MouseMove: { if (!_isDragging && _leftButton == MouseButtonState.Pressed) { var isXDragging = Math.Abs(mouse.Point.X - _dragStartPoint.X) > SystemParameters.MinimumHorizontalDragDistance; var isYDragging = Math.Abs(mouse.Point.Y - _dragStartPoint.Y) > SystemParameters.MinimumVerticalDragDistance; _isDragging = isXDragging || isYDragging; if (_isDragging) { OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MouseDragStart, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } } OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MouseMove, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideLeftButtonDown: case MouseEventType.LeftButtonDown: { DetectDoubleClick(MouseEventType.LeftButtonDoubleClick, mouse.Point); _leftButton = MouseButtonState.Pressed; _dragStartPoint = mouse.Point; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.LeftButtonDown, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideLeftButtonUp: case MouseEventType.LeftButtonUp: { //End drag. if (_isDragging) { OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MouseDragEnd, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); _isDragging = false; } _leftButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.LeftButtonUp, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideLeftButtonDoubleClick: case MouseEventType.LeftButtonDoubleClick: { _leftButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.LeftButtonDoubleClick, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); _leftButton = MouseButtonState.Released; break; } case MouseEventType.OutsideRightButtonDown: case MouseEventType.RightButtonDown: { DetectDoubleClick(MouseEventType.RightButtonDoubleClick, mouse.Point); _rightButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.RightButtonDown, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideRightButtonUp: case MouseEventType.RightButtonUp: { _rightButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.RightButtonUp, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideRightButtonDoubleClick: case MouseEventType.RightButtonDoubleClick: { _rightButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.RightButtonDoubleClick, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); _rightButton = MouseButtonState.Released; break; } case MouseEventType.OutsideMiddleButtonDown: case MouseEventType.MiddleButtonDown: { DetectDoubleClick(MouseEventType.MiddleButtonDoubleClick, mouse.Point); _middleButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MiddleButtonDown, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideMiddleButtonUp: case MouseEventType.MiddleButtonUp: { _middleButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MiddleButtonUp, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideMiddleButtonDoubleClick: case MouseEventType.MiddleButtonDoubleClick: { _middleButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MiddleButtonDoubleClick, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); _middleButton = MouseButtonState.Released; break; } case MouseEventType.MouseWheel: { OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MouseWheel, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button, data.High)); break; } case MouseEventType.MouseWheelHorizontal: { OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.MouseWheelHorizontal, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button, data.High)); break; } case MouseEventType.OutsideExtraButtonDown: case MouseEventType.ExtraButtonDown: { DetectDoubleClick(MouseEventType.ExtraButtonDoubleClick, mouse.Point); if (data.High == MouseFirstExtraButton) { _extraButton = MouseButtonState.Pressed; } else { _extra2Button = MouseButtonState.Pressed; } OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.ExtraButtonDown, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } case MouseEventType.OutsideExtraButtonDoubleClick: case MouseEventType.ExtraButtonDoubleClick: { if (data.High == MouseFirstExtraButton) { _extraButton = MouseButtonState.Pressed; } else { _extra2Button = MouseButtonState.Pressed; } OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.ExtraButtonDoubleClick, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); if (data.High == MouseFirstExtraButton) { _extraButton = MouseButtonState.Released; } else { _extra2Button = MouseButtonState.Released; } break; } case MouseEventType.OutsideExtraButtonUp: case MouseEventType.ExtraButtonUp: { if (data.High == MouseFirstExtraButton) { _extraButton = MouseButtonState.Released; } else { _extra2Button = MouseButtonState.Released; } OnMouseActivity?.Invoke(this, new SimpleMouseGesture(MouseEventType.ExtraButtonUp, mouse.Point.X, mouse.Point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button)); break; } //default: I can't return now, it will break the click detector. //return CallNextHookEx(hMouseHook, nCode, wParam, lParam); //HU3HU3 - A little funny momment: I just frooze my cursor by returning 1 instead of calling the next hook. - Nicke //Congrats to myself. ;D //05:24 AM 01/02/2014 (day-month-year) } #endregion //Call the next hook. return(CallNextHookEx(_mouseHookHandle, code, type, structure)); }
public void MoveMouse() => OnMouseActivity?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
/// <summary> /// A callback function which will be called every time a mouse activity detected. /// </summary> /// <param name="nCode"> /// [in] Specifies whether the hook procedure must process the message. /// If nCode is HC_ACTION, the hook procedure must process the message. /// If nCode is less than zero, the hook procedure must pass the message to the /// CallNextHookEx function without further processing and must return the /// value returned by CallNextHookEx. /// </param> /// <param name="wParam"> /// [in] Specifies whether the message was sent by the current thread. /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero. /// </param> /// <param name="lParam"> /// [in] Pointer to a CWPSTRUCT structure that contains details about the message. /// </param> /// <returns> /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx. /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook /// procedure does not call CallNextHookEx, the return value should be zero. /// </returns> private int MouseHookProc(int nCode, int wParam, IntPtr lParam) { //If Ok and someone listens to our events if ((nCode >= 0) && (OnMouseActivity != null)) { //Marshall the data from callback. var mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct)); //Detect button clicked var button = MouseButton.XButton1; short mouseDelta = 0; #region Switch Mouse Actions switch (wParam) { case WM_LBUTTONDOWN: //case WM_LBUTTONUP: //case WM_LBUTTONDBLCLK: button = MouseButton.Left; break; case WM_RBUTTONDOWN: //case WM_RBUTTONUP: //case WM_RBUTTONDBLCLK: button = MouseButton.Right; break; case WM_MOUSEWHEEL: //If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta. //One wheel click is defined as WHEEL_DELTA, which is 120. //(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value mouseDelta = (short)((mouseHookStruct.mouseData >> 16) & 0xffff); //TODO: X BUTTONS (I havent them so was unable to test) //If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, //or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, //and the low-order word is reserved. This value can be one or more of the following values. //Otherwise, mouseData is not used. button = MouseButton.Middle; break; case WM_MBUTTONDOWN: //case WM_MBUTTONUP: //case WM_MBUTTONDBLCLK: button = MouseButton.Middle; break; default: return(CallNextHookEx(hMouseHook, nCode, wParam, lParam)); //HU3HU3 - A little funny momment: I just frooze my cursor by returning 1 instead of calling the next hook. - Nicke //Congrats to myself. ;D //05:24 AM 01/02/2014 (day-month-year) } #endregion //Double clicks int clickCount = (wParam == WM_LBUTTONDBLCLK || wParam == WM_RBUTTONDBLCLK) ? 2 : 1; //Generate event var e = new CustomMouseEventArgs(button, clickCount, mouseHookStruct.pt.x, mouseHookStruct.pt.y, mouseDelta); //Raise it OnMouseActivity?.Invoke(this, e); } //Call next hook return(CallNextHookEx(hMouseHook, nCode, wParam, lParam)); }
static int clickCount; // for double click detection /// <summary> /// A callback function which will be called every time a mouse activity detected. /// </summary> /// <param name="nCode"> /// [in] Specifies whether the hook procedure must process the message. /// If nCode is HC_ACTION, the hook procedure must process the message. /// If nCode is less than zero, the hook procedure must pass the message to the /// CallNextHookEx function without further processing and must return the /// value returned by CallNextHookEx. /// </param> /// <param name="wParam"> /// [in] Specifies whether the message was sent by the current thread. /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero. /// </param> /// <param name="lParam"> /// [in] Pointer to a CWPSTRUCT structure that contains details about the message. /// </param> /// <returns> /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx. /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook /// procedure does not call CallNextHookEx, the return value should be zero. /// </returns> private int MouseHookProc(int nCode, int wParam, IntPtr lParam) { //If not ok and no one listens to our events, call next hook. if (nCode < 0 || OnMouseActivity == null) { return(CallNextHookEx(_hMouseHook, nCode, wParam, lParam)); } //Marshall the data from callback. var mouse = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct)); #region Switch Mouse Actions switch ((MouseEventType)wParam) { case MouseEventType.MouseMove: OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.MouseMove, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.ExtraButtonDown: case MouseEventType.LeftButtonDown: System.TimeSpan deltaMs = DateTime.Now - lastClickTime; lastClickTime = DateTime.Now; if (deltaMs.TotalMilliseconds <= Native.GetDoubleClickTime()) { clickCount++; } else { clickCount = 1; } if (clickCount == 2) { OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.LeftButtonDoubleClick, _leftButton, _rightButton, _middleButton)); clickCount = 0; } _leftButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.LeftButtonDown, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.ExtraButtonUp: case MouseEventType.LeftButtonUp: _leftButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.LeftButtonUp, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.ExtraButtonDoubleClick: case MouseEventType.LeftButtonDoubleClick: _leftButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.LeftButtonDoubleClick, _leftButton, _rightButton, _middleButton)); _leftButton = MouseButtonState.Released; break; case MouseEventType.Extra2ButtonDown: case MouseEventType.RightButtonDown: _rightButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.RightButtonDown, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.Extra2ButtonUp: case MouseEventType.RightButtonUp: _rightButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.RightButtonUp, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.Extra2ButtonDoubleClick: case MouseEventType.RightButtonDoubleClick: _rightButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.RightButtonDoubleClick, _leftButton, _rightButton, _middleButton)); _rightButton = MouseButtonState.Released; break; case MouseEventType.MiddleButtonDown: _middleButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.MiddleButtonDown, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.MiddleButtonUp: _middleButton = MouseButtonState.Released; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.MiddleButtonUp, _leftButton, _rightButton, _middleButton)); break; case MouseEventType.MiddleButtonDoubleClick: _middleButton = MouseButtonState.Pressed; OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.MiddleButtonDoubleClick, _leftButton, _rightButton, _middleButton)); _middleButton = MouseButtonState.Released; break; case MouseEventType.MouseWheel: //If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta. //One wheel click is defined as WHEEL_DELTA, which is 120. //(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value OnMouseActivity?.Invoke(this, new CustomMouseEventArgs(mouse.pt.X, mouse.pt.Y, MouseEventType.MouseWheel, _leftButton, _rightButton, _middleButton, (short)((mouse.mouseData >> 16) & 0xffff))); break; //If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, //or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, //and the low-order word is reserved. This value can be one or more of the following values. //Otherwise, mouseData is not used. //default: I can't return now, it will break the click detector. //return CallNextHookEx(hMouseHook, nCode, wParam, lParam); //HU3HU3 - A little funny momment: I just frooze my cursor by returning 1 instead of calling the next hook. - Nicke //Congrats to myself. ;D //05:24 AM 01/02/2014 (day-month-year) } #endregion //Call next hook return(CallNextHookEx(_hMouseHook, nCode, wParam, lParam)); //Not sure why, but it throws me an error. }
/// <summary> /// A callback function which will be called every time a mouse activity detected. /// </summary> /// <param name="nCode"> /// [in] Specifies whether the hook procedure must process the message. /// If nCode is HC_ACTION, the hook procedure must process the message. /// If nCode is less than zero, the hook procedure must pass the message to the /// CallNextHookEx function without further processing and must return the /// value returned by CallNextHookEx. /// </param> /// <param name="wParam"> /// [in] Specifies whether the message was sent by the current thread. /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero. /// </param> /// <param name="lParam"> /// [in] Pointer to a CWPSTRUCT structure that contains details about the message. /// </param> /// <returns> /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx. /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook /// procedure does not call CallNextHookEx, the return value should be zero. /// </returns> private int MouseHookProc(int nCode, int wParam, IntPtr lParam) { // if ok and someone listens to our events if ((nCode >= 0) && (OnMouseActivity != null || OnMouseDown != null || OnMouseUp != null)) { //Marshall the data from callback. MouseLLHookStruct mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct)); //detect button clicked MouseButtons button = MouseButtons.None; short mouseDelta = 0; //mouseButton down bool isMouseButtonDown = false; //mouseButton up bool isMouseButtonUp = false; switch (wParam) { case WM_LBUTTONDOWN: //case WM_LBUTTONUP: //case WM_LBUTTONDBLCLK: button = MouseButtons.Left; isMouseButtonDown = true; break; case WM_LBUTTONUP: button = MouseButtons.Left; isMouseButtonUp = true; break; case WM_RBUTTONDOWN: //case WM_RBUTTONUP: //case WM_RBUTTONDBLCLK: button = MouseButtons.Right; isMouseButtonDown = true; break; case WM_RBUTTONUP: button = MouseButtons.Right; isMouseButtonUp = true; break; case WM_MOUSEWHEEL: //If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta. //One wheel click is defined as WHEEL_DELTA, which is 120. //(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value mouseDelta = (short)((mouseHookStruct.mouseData >> 16) & 0xffff); //TODO: X BUTTONS (I havent them so was unable to test) //If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, //or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, //and the low-order word is reserved. This value can be one or more of the following values. //Otherwise, mouseData is not used. break; } //double clicks int clickCount = 0; if (button != MouseButtons.None) { if (wParam == WM_LBUTTONDBLCLK || wParam == WM_RBUTTONDBLCLK) { clickCount = 2; } else { clickCount = 1; } } //generate event MouseEventArgs e = new MouseEventArgs( button, clickCount, mouseHookStruct.pt.x, mouseHookStruct.pt.y, mouseDelta); //raise it OnMouseActivity?.Invoke(this, e); //raise mouseDown if (isMouseButtonDown) { OnMouseDown?.Invoke(this, e); } //raise mouseUp if (isMouseButtonUp) { OnMouseUp?.Invoke(this, e); } } //call next hook return(CallNextHookEx(hMouseHook, nCode, wParam, lParam)); }