C# Mouse Movement Outside Form [duplicate]

烈酒焚心 提交于 2019-12-10 13:36:32

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/20386876/c-sharp-mouse-movement-outside-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!