public void OnMousePress(WorkLogForm.DCIEngine.FrameWork.Snap.Hook.KeyboardMouseHook.MouseHookStruct hookStruct, out bool isNeedStop) { isNeedStop = false; // 读取鼠标坐标 //this.user_label.Text = "(" + hookStruct.pt.x.ToString() + "," + hookStruct.pt.y.ToString() + ")"; if (hookStruct.pt.x != this.theXPosition) { theXPosition = hookStruct.pt.x; timeCount = 0; this.timerOfMouseOrKeyUnDo.Stop(); } else { this.timerOfMouseOrKeyUnDo.Start(); } if (hookStruct.mouseAction == WorkLogForm.DCIEngine.FrameWork.Snap.Hook.KeyboardMouseHook.MouseHookStruct.MouseActionEnum.RightButtonUp) { //读取鼠标动作 //MessageBox.Show("右击"); //TODO:修改捕获的鼠标消息 //慎用,如果同时屏蔽键盘所有键,则只能重启才能退出 //可以修改成定时自动退出或捕获一定次数后自动退出。。。 //isNeedStop = true; } }
public void OnKeyboardPress(WorkLogForm.DCIEngine.FrameWork.Snap.Hook.KeyboardMouseHook.KeyboardHookStruct hookStruct, out bool isNeedStop) { isNeedStop = false; if (hookStruct.vkCode >= (int)Keys.A && hookStruct.vkCode <= (int)Keys.Z) { // 读取 Keys key = (Keys)hookStruct.vkCode; //MessageBox.Show("你输入了 " + (key == Keys.None ? "" : key.ToString()) + " 键"); this.timeCount = 0; this.theXPosition = -100; // 修改 //hookStruct.vkCode = (int)Keys.NumPad0; // 拦截 //isNeedStop = true; } }