C#鼠标移动外部形状 [英] C# Mouse Movement Outside Form

查看:217
本文介绍了C#鼠标移动外部形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的代码中跟踪鼠标移动。它很容易跟踪窗体窗口中的鼠标移动,但我想跟踪鼠标移动我的窗口外面。我的意思是我会最小化我的托盘和跟踪它的。任何想法如何跟踪我的窗体外面的示例代码或示例说明链接的鼠标移动?我使用c#,我想知道如何。感谢您的帮助。



对于窗体我试过这个链接,它可以完美地工作。



我想要什么。 >

我想知道当用户将鼠标从左到右或从右到左移动,并显示有关警告的消息。



我想要我的应用程序作为一个服务(实际上它不是那么必要,如果你可以帮助表单应用程序,这将是公平的)和启动与os。和跟踪鼠标移动并捕获,如果用户将他/她的鼠标从左到右或从右到左移动。而已。我希望这个编辑将是非常具体的解释。

解决方案

为了正确地做,我想你将需要使用全局钩子。 似乎不错,是C#管理的代码。


I am trying to track mouse movements in my code. It's easy to track mouse movements in form window but i wanted to track mouse movements outside of my from window. i mean i will minimize my from to tray and track where it is. Any idea how to track mouse movemtns outside of my form windows with sample codes or sample explanation links? I am using c# and i would like to know how. Thanks for your help.

For form windows i tried this link and it works perfectly.

What i want.

I want to get to know when user move mouse left to right or right to left and show message about warning.

I want my application as a service (actually its not so neccessary if you can help on form application it will be fair enough too) and startup with os. and track mouse movements and catch if user move his/her mouse left to right or right to left. Thats it. I hope this edit will be very specific explanation.

解决方案

To do this properly, I think you will need to use global hooks. This seems nice and is C# managed code.

这篇关于C#鼠标移动外部形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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