如何捕获全局鼠标单击事件并抑制其动作? [英] How to catch global mouse click events and suppress it's action ?

查看:111
本文介绍了如何捕获全局鼠标单击事件并抑制其动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i希望在Windows中的任何地方捕获所有鼠标点击事件[意味着全局鼠标事件]并禁止其动作。

使用以下代码我可以抑制我的应用程序表单中的鼠标单击事件不在我的应用程序表单之外:

Hi,
i want to capture all mouse click event anywhere in the windows [means global mouse events] and suppress its action.
using following code i can suppress the mouse click events in my application's form only not outside of the my app form :

protected override void WndProc(ref Message m)
{
    if (m.Msg == (int)MouseMessages.WM_LBUTTONDOWN || m.Msg == (int)MouseMessages.WM_LBUTTONUP)
        MessageBox.Show("Click event caught!");  //return; --to suppress the mouse click
    else
        base.WndProc(ref m);
}



请有人告诉我如何实现这一目标?


Please can anyone tell me how can i achieve this?

推荐答案

如何在Visual C#.NET中设置Windows挂钩 [ ^ ]。


这篇关于如何捕获全局鼠标单击事件并抑制其动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆