KeyPressEventHandler无法在Window Services中工作 [英] KeyPressEventHandler not working in Window Services

查看:118
本文介绍了KeyPressEventHandler无法在Window Services中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


     我正在尝试使用  KeyPressEventHandler捕获密钥钩。


我已经在Windows窗体应用程序中实现了它


现在我想要使用窗口服务。


它编译精细&服务也可以开始和停止了


但问题在于


KeyPressEventHandler没有对用户的按键做出反应。


(威胁  ;当任何键按下KeyPressEventHandler应该引发事件。但是它在窗口服务中不起作用)


 


所以那里有在窗口服务中使用KeyPressEventHandler有什么问题吗?


是否可以使用它?


你可以帮助我吗?


 


 

解决方案


您可以向我们提供您尝试做的更多信息吗?


一般情况下,很难满足您的要求,因为您只能获得会话中发生的关键事件。 Windows服务在自己的会话中运行,因此您不会看到用户的任何关键事件。 (并且可以在
的同时进行多次会话!)


亲切的问候,


Konrad


hi

     I am trying to capture key hook using KeyPressEventHandler .

I have achieved it in windows form application

now i want to do this using Window Services.

It Compiles fine & services can also be start & stopped

but here problem is that

KeyPressEventHandler not reacting for key press by user.

(menace when any key press the KeyPressEventHandler should raise event. but it is not working in window services)

 

so is there any problem by using KeyPressEventHandler in window services?

does it possible to use it?

can you please help me for that?

 

 

解决方案

Hi,

can you provide us with more information what you tried to do?

In general, it is quite hard to fullfill your requirement, because you only get the key events that happen in your session. Windows Services run in their own session so you do not see any key events of the user. (And there can be multiple sessions at the same time!)

With kind regards,

Konrad


这篇关于KeyPressEventHandler无法在Window Services中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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