捕获从Windows服务在C#中的关键事件 [英] Capture key events from a Windows Service in C#
问题描述
我必须写在C#中监听到被按下了任何键的应用程序。实际上我有一个条形码扫描仪发送按键事件,我要听它...它做什么,从没有超出我的问题的范围。
I have to write an application in C# that listens to any keys being pressed. In actuality I have a bar code scanner sending the "key pressed" event, and I need to listen it... what it does from there is beyond the scope of my question.
我的安全需求是存在的不允许任何登录以机器以任何方式或形式和这必须运行作为Windows服务。用户将启动机器,然后走开(即没有桌面会话)。
My security requirements are that there is not allowed to be any sign-on to the machine in any way shape or form AND this must run as a windows service. The user will start the machine and walk away (i.e., no desktop session).
我假设我将不得不去非托管这一点。
I'm assuming I'm going to have to go unmanaged for this.
由于安全要求是这甚至可能吗?提前如果是这样,就从哪里开始的指针将是巨大的。
Given the security requirements is this even possible? If so, any pointers on where to start would be great.
谢谢,
周杰伦
Thanks in advance, Jay
推荐答案
尝试键盘和鼠标钩子
的 http://www.codeproject.com/KB/cs/globalhook.aspx
这篇关于捕获从Windows服务在C#中的关键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!