keyevent

Java Robot with Azerty vrs Qwerty

戏子无情 提交于 2019-12-01 11:12:30
问题 I hope this isn't a duplicate, but I've scoured the forums and have yet to find any answers. I am having issues with my java application using the Robot class to type text. The text is provided and the application types it out. When the user has a QWERTY keyboard everything works fine. When the user has an AZERTY keyboard the values come out incorrectly. For example feeding "1234567890" into the software types "&é"'(§è!çà" I'm hoping some people have an idea how to support multiple keyboard

Detect if keyboard or mouse events are triggered by a software

女生的网名这么多〃 提交于 2019-12-01 10:46:21
Is there a way to determine whether the keyboard or mouse events are triggered from a hardware rather than an application like TeamViewer, Steam or some other remote desktop software in a desktop application running on Windows? My purpose is not to prevent bots, but to prevent remote access to the application. It seems that RawInput API lets me detect fake events sent using SendInput API. Is it correct? The low-level keyboard/mouse hooks provided by SetWindowsHookEx() report if input was generated by actual devices or injected by application code. For a low-level keyboard hook , the hook

Detect if keyboard or mouse events are triggered by a software

ⅰ亾dé卋堺 提交于 2019-12-01 08:25:46
问题 Is there a way to determine whether the keyboard or mouse events are triggered from a hardware rather than an application like TeamViewer, Steam or some other remote desktop software in a desktop application running on Windows? My purpose is not to prevent bots, but to prevent remote access to the application. It seems that RawInput API lets me detect fake events sent using SendInput API. Is it correct? 回答1: The low-level keyboard/mouse hooks provided by SetWindowsHookEx() report if input was

How to set on key press key binding?

不羁岁月 提交于 2019-12-01 07:47:09
问题 The arrow keys for this application need to cause press and release events independent of focus. Setting onKeyRelease true causes a release event as expected but setting onKeyRelease false (code below) doesn't seem to stop auto-repeat. Is there a way to implement the key binding to trigger once when the arrow key is pressed and held? Action right = new AbstractAction() { public void actionPerformed(ActionEvent e) { ... } }; mainPanel.getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put

How to get current modifier states with FireMonkey on OSX?

纵饮孤独 提交于 2019-12-01 06:30:59
With Delphi for Windows, I usually use this code: function isCtrlDown : Boolean; var ksCurrent : TKeyboardState; begin GetKeyboardState(ksCurrent); Result := ((ksCurrent[VK_CONTROL] and 128) <> 0); end; How can I achieve this with FireMonkey on Mac OSX? I have found this , but I don't know how to manage it with FireMonkey/Delphi (which uses, ...): void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) { UInt32 currentModifiers = GetCurrentKeyModifiers(); shiftKey = currentModifiers & ::shiftKey; ctrlKey = currentModifiers & ::controlKey;

Opera preventDefault() on keydown event

送分小仙女□ 提交于 2019-12-01 06:07:55
I'm trying to embed some keybindings in my webapp, and I'm having hard times with Opera. I have this code: window.onkeydown = function(e){ var key = e.keyCode ? e.keyCode : e.charCode ? e.charCode : false; if (e.ctrlKey && key === 84) { alert("foo"); e.preventDefault(); // return false; } } It works like a charm in Firefox and Chrome, but Opera still opens new tab. Same happens with return false; . My info: Opera/9.80 (X11; Linux i686; U; en) Presto/2.7.62 Version/11.00 Marcel Korpel Opera doesn't support preventDefault on keydown , only on keypress . As you can see in this example , you

Javascript - simulate key events on Chrome 53

帅比萌擦擦* 提交于 2019-12-01 04:21:29
问题 I am trying to simulate key event (press) on Chrome 53 . All the solutions that I found on StackOverflow seems not to be working.. My goal is to have a function that gets a keyCode and simulates a key press with it - Pure JS is required function keyPressSimulate(keyCode) {...?} Code samples that I already tried: Node.prototype.fire=function(type,options){ var event=new CustomEvent(type); for(var p in options){ event[p]=options[p]; } this.dispatchEvent(event); } document.fire("keyup",{ctrlKey

Opera preventDefault() on keydown event

六眼飞鱼酱① 提交于 2019-12-01 03:46:40
问题 I'm trying to embed some keybindings in my webapp, and I'm having hard times with Opera. I have this code: window.onkeydown = function(e){ var key = e.keyCode ? e.keyCode : e.charCode ? e.charCode : false; if (e.ctrlKey && key === 84) { alert("foo"); e.preventDefault(); // return false; } } It works like a charm in Firefox and Chrome, but Opera still opens new tab. Same happens with return false; . My info: Opera/9.80 (X11; Linux i686; U; en) Presto/2.7.62 Version/11.00 回答1: Opera doesn't

How to get current modifier states with FireMonkey on OSX?

我是研究僧i 提交于 2019-12-01 03:01:34
问题 With Delphi for Windows, I usually use this code: function isCtrlDown : Boolean; var ksCurrent : TKeyboardState; begin GetKeyboardState(ksCurrent); Result := ((ksCurrent[VK_CONTROL] and 128) <> 0); end; How can I achieve this with FireMonkey on Mac OSX? I have found this, but I don't know how to manage it with FireMonkey/Delphi (which uses, ...): void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) { UInt32 currentModifiers =

C# - System.Windows.Forms.Keys - How to keep application hotkeys in one place

淺唱寂寞╮ 提交于 2019-11-30 23:48:10
I have few "hotkeys" in my application. All "hotkeys" sequences are unique in application scope (so for example F12 key will always fire the same single task). In few places there are handled like here: if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.Delete) { this.Close(); } if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.Up) { if (Program.PerformLogin()) { frmConfigurationSetup frmSetup = new frmConfigurationSetup(); frmSetup.Show(); } } if (e.KeyCode == Keys.F12) { frmAbout formAbout = new frmAbout(); formAbout.Show(); } But I have idea to keep all keyboard shortcuts used in my app in