如何在Windows服务中编写KeyPress事件的代码 [英] How to code KeyPress event in windows servicce

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

问题描述

谁能告诉我如何在Windows服务中为键盘键(而不是控件)实现KeyPress事件

我想跟踪按Enter键的次数,而无论
我打开了多少个应用程序并做了一些工作,在后台我想要一个计数器来显示
按下Enter键的次数.

Could anyone tell me how to implement KeyPress event in a windows service for keyboard keys(not for controls)

I want to track the number of times i pressed the Enter Key irrespective of
how many application I opened and did some work, on the background i want a counter that shows the
count of number of times enter key is pressed

推荐答案

您不能,因为该服务没有可聚焦的窗口.您可能是想编写一个系统范围的键盘挂钩.
You can''t, because the service does not have a window to have focus. You probably mean you want to write a system wide keyboard hook.


在这种情况下,您能告诉我如何实现Windows挂钩吗?
一个简单的

我在Google上进行了搜索,但找不到相关的内容
In that case could u tell me how to implement a windows hook
a simple ones,

i searched on the google but couldn''t find related ones


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

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