在 C# 中捕获和发送键盘/鼠标输入 [英] Capture and send keyboard / mouse input in C#

查看:24
本文介绍了在 C# 中捕获和发送键盘/鼠标输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种发送和接收键盘信息的方法,而不管哪个应用程序具有焦点.我记得在大学时看到一个关于旧的 Windows API 的演示文稿,它可以让您更改光标位置并发送右键单击等.

I am looking for a way to send and receive keyboard information regardless of what app has focus. I remember back in College seeing a presentation about an old Windows API that let you change the cursor position and send right clicks and such.

除了 User32.dll 之外,还有没有办法用 .net 框架做到这一点?

Besides User32.dll is there a way to do this with the .net framework?

推荐答案

AFAIK,没有办法捕获全局键盘 &鼠标事件.但是在 CodeProject 上有几篇文章演示了如何为其创建 .NET 类包装器.

AFAIK, there's no way to capture the GLOBAL keyboard & mouse events. But there are a few articles on CodeProject which demonstrate the creation of .NET class wrappers for the same.

您可以在这里查看它们:

You can check them out here:

1) 在 C# 中处理全局鼠标和键盘挂钩

2) 全局鼠标和键盘库

顺便说一句,我使用第一个库在 C# 中创建了一个小型键盘记录器 :)

BTW, I had created a SMALL keylogger in C# using the 1st library :)

这篇关于在 C# 中捕获和发送键盘/鼠标输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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