当我的应用程序处于活动状态时,如何处理第 3 方组合键?

发布于 2024-08-18 04:06:32 字数 205 浏览 7 评论 0原文

任务栏的通知区域中有一个小型的第 3 方程序,它使用 Ctrl-F11 组合键来执行任务。问题是我使用相同的快捷方式,但我的快捷方式被另一个快捷方式遮挡。基本上,当用户按下 Ctrl-F11 时,即使我的窗口是当前活动的窗口,我也无法执行我的操作。我以为活动窗口会优先使用组合键,但显然事实并非如此。考虑到该程序是用 .NET C# 编写的,当我的应用程序处于活动状态时,如何获得快捷方式优先级?

There is a small 3rd-party program in the notification area of the taskbar that uses Ctrl-F11 key combination to do a task. The problem is I am using the same shortcut but mine is shadowed by the other one. Basically, I can not do my thing when the user presses Ctrl-F11 even though my window is the one that is currently active. I thought the active window would have the priority in using key combinations, but apparently it is not the case. Considering the program is written in .NET C#, how can I get the shortcut precedence when my application is active?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2024-08-25 04:06:32

如果您无法更改托盘应用程序的组合键,则必须在应用程序中使用相同的组合键。
一种极端的方法可能是用 C++ 或 Delphi 编写 Windows Hook DLL,并过滤 Ctrl-F11 的所有按键并向您的应用程序发送消息。

这不是一项小任务,有些项目可以在代码项目等上挂钩 Windows 键盘事件。您可以调整其中之一。当您收到按键并且您的窗口/窗体处于活动状态时,您可以使用 SendMessage 向您的窗口发送消息。

这将是最后一次恢复。这取决于你有多需要它。

If you cannot change the Key combination of the tray app and you must use the same in your app.
An extreme approach could be to write a Windows Hook DLL in C++ or Delphi and filter all key presses for Ctrl-F11 and send a message to your app.

This is no small task, there are projects that hook the Windows Keyboard events on Code Project etc. You could adapt one of those. When you receive the keypress and your Window/Form is active you could use SendMessage to message your window.

This would be a last restort. It depends how badly you need it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文