在WIndow服务中捕获KeyPress事件 [英] Capturing KeyPress Event in WIndow Service

查看:191
本文介绍了在WIndow服务中捕获KeyPress事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个窗口服务来创建一个小键盘记录器应用程序。我是Windows服务的新手,唯一的目的就是学习。

I am trying to create a window service to create a small keylogger application. I am new to Windows services and my sole purpose is to learn.

如何获取Winforms中可用的所有事件,但在Windows服务中?

How can I obtain all the events that are available in Winforms, but in a Windows service?

I我试图在谷歌搜索,但我无法找出如何做到这一点。我获得了许多对keyhook DLL的引用。

I've tried searching on Google, but I'm unable to find out how to do this. I'm getting many references to keyhook DLLs.

推荐答案

Windows服务不是基于表单,因此您不能这样做.. ..看看 here ,了解如何创建Windows服务的示例杀死其他窗口。

Windows Services are not form based therefore you cannot do it that way.... Have a look here for an example of how to create a Windows Service that kills other windows.

窗口服务不是放置表单的理想场所...想想在Linux / Unix变体下的守护进程 - 他们没有图形显示或互动与用户本身一样,因此对于想要一个字的人来说是无头脑的,因为没有任何互动,而且一个服务将在系统服务帐户下运行....

A window service is not an ideal spot to place a form on... think of a daemon under Linux/Unix variants - they do not have a graphical display nor interact with the user as such and hence would be 'headless' for want a word for it as there's no interaction whatsoever, and furthermore, a service would be running under a system service account....

说到键盘记录器,它不会这样 - 你需要钩入全局键盘钩子并截取键,这样的一个例子是这里

Speaking of Keyloggers, it does not work like that - you need to hook into the global keyboard hook and intercept the keys, an example of such a thing is here.

但是,为什么会聚集数据等 - 可能AV会把它们标记为恶意软件...如果你是为自己做的 - 这是很好的...但是恶意地将它放在另一台电脑上,没有用户知道它是非常iffy,可能会在法庭上根据当地法律侵犯隐私等等。

But then the question will arise for what purpose, gather data, etc - possibly AV's will flag them as malware... If you are doing it for yourself - that's good...but to maliciously place it on another computer without that user knowing about it is very iffy and could end up in court for invasion of privacy, in terms of local laws etc.

这篇关于在WIndow服务中捕获KeyPress事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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