I'm trying to add a feature to my AIR app that can listen for (configurable) global keyboard events even when the app is minimized. Ex: CTRL-ALT-SHIFT-F12 to grab a screenshot.
I can't find any way to register a keyboard hook, and listening for keyboard events only captures them when the app has focus. Suggestions?
I don't think that Adobe Air programs can process keypress events unless the application is in focus.
http://forums.adobe.com/thread/420446
Even this question regarding a Global handler for keypresses states that the application must be in focus.
Try hooking onto the stage's KeyboardEvent:
stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyHandler);
function KeyHandler(e:KeyboardEvent){
trace ("Key Code: " + e.keyCode);
trace ("Control? " + e.ctrlKey);
trace ("Shift? " + e.shiftKey);
trace ("Alt? " + e.altKey);
}
With NativeProcess, you could write an external app pretty easily to listen for global keyboard events and send them back to your AIR app. I might be going down this path now...
I'm testing my Air application in Flash CS5 and I need to disable keyboard shortcuts so I can test my own shortcuts. I can get ctrl-F to work, but ctrl-C will not.
I notice that my keyboard shortcuts WILL work if it's a standard AS3 file that I'm testing.
One method I use is to monitor the clipboard in the AIR app, that only allows you to react based on copied data, but it's at least sort of a way to listen for input when the app does not have focus.
Related
I need a program to respond while not active/not selected by user or minimized to KeyCodes.
Anyone got ideas? In VB.NET.
This won't work out of the box as key messages are only sent to the active window. A minimized window is never active.
What you could try is register system-wide hotkeys. You could also try to install a keyboard hook, however, this would affect the entire system and your application would receive all the keystrokes performed. This would require efficient filtering.
Is there any API in Windows 8 that tells you whether there is a Keyboard connected to your device? I believe the OS should have information about this, but I am not sure that it is exposed.
I checked the Windows.Devices.Input.KeyboardCapabilities(). It only returns an object with a property keyboardPresent that equals to 1 on my touch device or non-touch device.
The problem has already been reported on stackoverflow without solution (Provide another solution but which also don't seem to work).
Maybe a work around could be to add a TextBox outside the screen and set the focus on it and register InputPane.GetForCurrentView().Showing and to see if it is fired or not. If it is you can deduce that there is no keyboard connected (and you might be able to reset the focus to the page inside the event so that the keyboard don't actually pop up) and if it don't fired that the there is a keyboard connected. That not a really good solution but might be the best available ...
I'm developing a Windows Store app for an embedded application where the only input device is a small touchscreen. For this reason I'm developing my own number and text entry controls that match the visual look of the application and work better on the small screen. Is it possible to prevent the Windows 8 on-screen keyboard from appearing when a textbox gets focus?
You can't, it's a user preference as of now.
Similar question is found here
From Hanselman
Unfortunately there is no checkbox or "just turn it off" way to
disable the keyboard with a supported option.
However, there is a way to effectively disable the keyboard by
stopping the service that controls it.
Press the Windows key + W Type "services," and press Enter Scroll down
to "Touch screen keyboard and handwriting panel" You can either right
click and "Stop" or you can double-click and change it from
"Automatic" startup to "Manual."
Hello I have a VB NET application and I would like to add it a keybord key pressed catching system so I can track any keybord key that is pressed on any application that is running on my computer and uses keybord.
If someone has any idea thanks for sharing it.
I Hope my question was clear.
Thanks.
You will need to use a Global KeyBoard hook, look at this CodePlex Project. It will allow you to intercept the Global Keyboard events.
From Link:
This library allows you to tap keyboard and mouse and to detect and
record their activity even when an application is inactive and runs in
background.
This library attaches to windows global hooks, tracks keyboard and
mouse clicks and movement and raises common .NET events with
KeyEventArgs and MouseEventArgs, so you can easily retrieve any
information you need:
Is it possible to assign a global hotkey to a specific feature in an Adobe AIR app, i.e. the app feature responds to the hotkey whether the app is active or not (it must be running of course, but only in the system tray).
I don't this it's possible with Adobe AIR itself. The only method I can think of:
Install 3rd party hotkey application (like AutoHotkey or HotKeyBind)
Configure hotkey application to make CTRL+ALT+Q to launch
"c:\programs\thvo42\coolapp.exe --hotkey q"
In your AIR application, register for the NativeApplication.invoke event, and watch for arguments like '--hotkey q' to know that the Q hotkey was pressed, and then act accordingly.
Of course, this is kind of a hassle, maybe with some hacking you can roll it all into a single install file.
From the Reference Manual:
To listen globally for key events, listen on the Stage for the capture and target or bubble phase.
SWFKit creates a wrapper around your flash/flex movie, and allows access to system DLLs and other goodies, but unfortunately it would export as an .exe, so windows only and no AIR.
ASFAIK, there is no support for it by using AIR alone.