本文介绍了如何使用低级鼠标挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我正在制作一个快速启动程序,当用户按住鼠标左键时会自动快速点击。



我通常会使用GetAsyncKeyState,但由于同样检测到原始输入,它会检测程序发出的点击,然后继续点击并永不停止。



问题示例:





代码:



Hello!
I am making a rapid-fire program, that autoclicks fast when the user holds the Left-mouse button down.

I usually would use GetAsyncKeyState, but since the same detects raw input, it will detect the clicks made by the program, and then continue clicking and never stop.

Example of problem:


Code:

if (GetAsyncKeyState(VK_LBUTTON))
  {
  mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
  mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
  Sleep (10);
  }



我已经搜索了几天,并且所有线程都说让我使用低级MouseHook,文档非常混乱(特别是对于初学者)。



我怎么能做这个工作,有人能给我一个鼠标勾的例子,检测左鼠标持有并将真值返回给bool变量吗?



感谢您的阅读!



我的尝试:



GetAsyncKeyState不起作用,我已经尝试了几种方法来实现它。


I have searched for days, and all threads said for me to use a Low-Level MouseHook, The documentation is very confusing (especially for a beginner).

How could I make this work, could someone give me an example of a mouse hook detecting left mouse to hold and return a true value to a bool variable?

Thanks for reading!

What I have tried:

GetAsyncKeyState will not work, I have tried several ways of implementing it.

推荐答案


这篇关于如何使用低级鼠标挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 11:39