无论 vb.net 中的活动应用程序如何,读取 keydown
我之前问过一个关于 vb.net 中的 keyhooks 的问题。
我当前的问题是这样的:
我创建了一个程序,只要同时按下某组键,该程序就应该执行特定的操作。该程序必须能够在后台运行,或者在系统托盘中运行。本质上,这应该像表单上的 KeyDown 事件一样工作,只不过本例中的表单就是一切。
我不确定是否有办法直接从 .net API 中执行此操作,但如果有的话我肯定还没有找到。
I asked a question earlier about keyhooks in vb.net.
My current issue is such:
I have created a program which should perform a certain action whenever a certain group of keys is pressed at the same time. The program must be able to run in the background, or in the system tray or something. Essentially, this should work like the KeyDown event on a form, except the form in this case is everything.
I'm not certain if there is a way to do this directly from within the .net API, but if there is I certainly have not found it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不需要键盘挂钩,您需要注册一个热键。实施起来更容易,对系统资源的要求也低得多。这是一个示例,如果表单被最小化,它会将表单恢复到前台。请注意,您可以注册多个密钥:
That doesn't require a keyboard hook, you'll want to register a hot key. Much easier to implement and much less demanding of system resources. Here's an example, it restores the form to the foreground if it was minimized. Note that you can register more than one key: