win32api:暂时阻止鼠标点击?
有没有办法使用 win API 禁用常规的 Windows 鼠标点击?我可以通过执行 ClipCursor
来禁用除特定点之外的任何位置的点击,但点击仍然会记录。
或者,我也想有条件地禁用鼠标单击...例如,我想让它不可能关闭我不控制的应用程序的窗口,所以我希望发送到该窗口的“X”的点击不会消失通过。
Is there any way to disable regular windows mouse clicks using the win API? I can disable clicks anywhere besides a particular point by doing ClipCursor
, but the clicks still register.
Alternatively I also want to disable mouse clicks conditionally... for example, I want to make it impossible to close a window of an application I don't control, so I want clicks sent to the 'X' of that window to not go through.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以,但这是非常危险的。以下是如何在 C++ 中
更改上例中的
false
以重新启用键盘工作。顺便说一句,这种技术也适用于键盘输入,即使 Ctrl+Alt+Del 也不起作用。
如果您想允许鼠标移动,但仅阻止点击,请添加一些
if ((wParam == WM_MOUSEMOVE) || (wParam == WM_NCMOUSEMOVE))
代码。更多信息请访问 http://msdn.microsoft.com/en -us/library/ms644986(VS.85).aspx
You can, and it's very dangerous. Here's how, in c++
Change the
false
in the example above to re-enable keyboard to work.BTW this technique also works similarly with keyboard input, even Ctrl+Alt+Del wont work.
If you want to allow the mouse to move, but block clicks only, add some
if ((wParam == WM_MOUSEMOVE) || (wParam == WM_NCMOUSEMOVE))
code.More info at http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx