简体   繁体   English

通过窗口热键进行露天应用

[英]open air application by window hotkeys

I am developing flex air application.I have to implement hot-key functionality in air application. 我正在开发flex air应用程序。我必须在air应用程序中实现热键功能。

For example whenever user press any two keys like ctr and S keys the open flex air application. 例如,每当用户按下任意两个键(如ctr和S键)时,打开flex air应用程序。 and whenever user press any two keys like ctr and q keys then close flex air application. 每当用户按下任意两个键(例如ctr和q键),然后关闭flex air应用程序。

Is it possible in flex? flex有可能吗?

Thanks 谢谢

It's not possible for a not-running program to intercept key commands. 没有运行的程序不可能截获关键命令。 As such you cannot tell the application to start on some key command; 因此,您无法告诉应用程序使用某些键盘命令启动; either the program needs to run already, or you need to set that key command to the OS (you can do that in Windows in the properties panel for example). 该程序需要已经运行,或者需要将该按键命令设置为OS(例如,可以在Windows的“属性”面板中执行此操作)。

The other command is rather easy, just listen for KeyDown events and check if your combination was pressed; 另一个命令非常简单,只需侦听KeyDown事件并检查是否按下了组合键即可; and if so, quit the application. 如果是这样,请退出该应用程序。

Not to my knowledge. 据我所知。

For this kind of functionality you need a daemon or a background process. 对于这种功能,您需要守护程序或后台进程。 Because in AIR it's not possible to listen for keys when not focused (alias key logger) it would have to be a native application (different versions for different OS). 因为在AIR中,如果没有重点(别名按键记录器),就不可能监听按键,因此它必须是本机应用程序(不同OS的不同版本)。

An alternative would be to somehow set a key stroke in the OS configuration - but then again, this is very different on different OS, and it is not supported by AIR - a native process would be required, too. 另一种选择是以某种方式在OS配置中设置一个按键-但是,同样,在不同的OS上这是非常不同的,并且AIR不支持-也将需要一个本机进程。

If you want to make this simple, it's not possible, unless you really want to invest a lot of time to write these processes, one for each different OS. 如果您想简化此过程,那是不可能的,除非您真的想花很多时间来编写这些过程,每个不同的操作系统一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM