C#中的守护程序来监听按键 [英] Daemon in C# to listen for keypress
问题描述
我正在寻找创建一个小的C#应用程序,该应用程序既可以作为守护程序运行,也可以坐在任务栏中,并等待特定的按键.当遇到预期的按键时,我将执行一些操作.
I'm looking to create a small C# application that will either run as a daemon or sit in the taskbar, and wait for a specific keypress. When the expected keypress is encountered, I'll perform some actions.
这将主要用于将数据快速发布到我正在编写的Web服务中.我已经在网上搜寻了一段时间,但是我的搜索字词太模糊了,还没有遇到任何具体的例子或指南.
This is going to be used primarily for quick-posting of data to a web-service I'm writing. I've looked around the net for a while, but my search terms have been too vague, and I haven't come across any concrete examples or guides.
谢谢
Mike Trpcic
Mike Trpcic
推荐答案
我在CodeProject上遇到了这个问题.当它不集中时,它将捕获击键.
I came across this on CodeProject. It'll capture keystrokes while it's not focused. CodeProject: A Simple C# Global Low Level Keyboard Hook
这篇关于C#中的守护程序来监听按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!