在我的应用程序在后台时监视 C# 中的键盘活动 [英] Monitoring keyboard activity in C# while my application is in the background

查看:33
本文介绍了在我的应用程序在后台时监视 C# 中的键盘活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我需要明确表示我对键盘记录没有兴趣.

First of all I need to make it clear that I have no interest in keylogging.

当我的应用程序在后台运行时,我需要一种方法来监控最基本的键盘活动.我不需要知道哪些键,我不需要保存任何数据,我根本不需要或不打算隐藏我的应用程序,我只需要知道何时按下键并调用方法.

I need a way to monitor keyboard activity at the most basic level while my application is in the background. I don't need to know which keys, I don't need to save any data, I don't need or plan to hide my application at all, all I need is to know when keys are pressed and invoke a method.

我正在寻找最简单的方法来做到这一点,我知道相当数量的 C#,但没有什么太复杂的,因为我的大部分知识都是自学的.

I'm looking for the simplest way to do this possible, I know a reasonable amount of C# but nothing too complex as most of my knowledge is self-taught.

我环顾四周寻找一些合适的方法,但没有发现任何有用的方法.我只发现一堆人在论坛和深度键盘记录器的源代码上说不,那是非法的".

I've looked around for some appropriate ways of doing this and I've found nothing useful. All I've found is a bunch of people saying "No, that's illegal" on forums and source code for in depth keyloggers.

如果你们中的任何人能就实现这一目标的方法向我提出建议,那么我将不胜感激.

If any of you could advise me on a way to achieve this then I would be most appreciative.

推荐答案

你需要使用 Window Hooks:

You'll need to use Window Hooks:

C# 中的低级键盘挂钩

但请注意,Windows 安全性可能会保护我们免于为所欲为!

But beware, Windows security, may be protecting us from doing what you want!

这篇关于在我的应用程序在后台时监视 C# 中的键盘活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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