简体   繁体   English

使用C#捕获鼠标单击和键盘按键

[英]Capture mouse clicks and keyboard key strokes using C#

I have a use case to capture mouse clicks and keyboard key strokes on a browser like IE using a C# program. 我有一个用例,可以使用C#程序在IE之类的浏览器上捕获鼠标单击和键盘按键。

How can we do this ? 我们应该怎么做 ?

Thanks, Gagan 谢谢,甘根

Answer lies in What you are actually trying to achieve? 答案在于您实际上要实现什么?

If this is a KeyLogger - that should works across on applications - Read about SetWindowsHookEx. 如果这是KeyLogger-应该可以在应用程序上使用-请阅读SetWindowsHookEx。

If you are trying to automate some testing of a browser based app/website - then there are better frameworks like Selenium etc. which should be considered. 如果您尝试对基于浏览器的应用程序/网站进行一些测试自动化,则应考虑使用更好的框架,如Selenium等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM