hotkeys

Register hotkeys in .NET - combination of three/four keys

久未见 提交于 2019-12-18 07:21:41
问题 I got stuck. Right now, I am using the following code to listen to hotkeys: [DllImport("user32.dll")] public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc); [DllImport("user32.dll")] public static extern bool UnregisterHotKey(IntPtr hWnd, int id); protected override void WndProc(ref Message m) { if (m.Msg == 0x0312) { // whatever i need } base.WndProc(ref m); } and this function to register hotkey: Form1.RegisterHotKey(this.Handle, this.GetType().GetHashCode(

Detecting Ctrl+V with RegisterHotKey but not intercepting it

痞子三分冷 提交于 2019-12-17 18:59:13
问题 I need to detect when a user presses Ctrl + V (regardless of window focus - my app will likely be minimised) but I must not stop the actual paste operation. I have tried a few things: (I am successfully binding to keystrokes with RegisterHotKey) I have: protected override void WndProc(ref Message m) { if (m.Msg == 0x312) hotKey(); base.WndProc(ref m); } and I've tried the following: void hotKey() { SendKeys.SendWait("^v"); //just puts 'v' instead of clipboard contents } and void hotKey() {

Global hotkeys in WPF working from every window

≡放荡痞女 提交于 2019-12-17 16:27:52
问题 I have to use hotkeys which will be working from every window and pulpit. In winforms I used: RegisterHotKey(this.Handle, 9000, 0x0002, (int)Keys.F10); and UnregisterHotKey(this.Handle, 9000); and protected override void WndProc(ref Message m) { base.WndProc(ref m); switch (m.Msg) { case 0x312: switch (m.WParam.ToInt32()) { case 9000: //function to do break; } break; } } In my WPF aplication I tried do: AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent); and private void

C++/Qt Global Hotkeys

三世轮回 提交于 2019-12-17 14:52:24
问题 I'm working on an application, which I need to run in the background and run a function when a certain combination of buttons is pressed. I kind of understand that this requires a platform-specific API call (WIN32, X11, etc.), but I don't really know how to start. Also, is there a multi-platform way to achieve this? I really need this to work on Windows, Linux, and OSX. 回答1: To summarize: The Qt Event System may be an option (with some help on system/desktop manager level) Qxt Library (not

Send global keystroke / fake a global hotkey from a Winforms application

大憨熊 提交于 2019-12-14 03:19:40
问题 For my current winforms win7 project I need to simulate some global hotkey presses. I tried sending the keystrokes with SendMessage directly to the program interceptin the hotkeys, but that doesnt work. The program doesnt seem to handle incoming hotkeys when it's foccused / send directly to them. How would I send simulated keypresses so that they get recognized as Global Hotkeys? Thanks in advance! EDIT: I dont want to Set hotkeys for my app, I want to trigger them in another application From

JavaFX InputMap/ActionMap equivalent?

丶灬走出姿态 提交于 2019-12-14 00:41:00
问题 I'm finally switching over fully to JavaFX. I'm very keen on keystroke functionality. Is there an equivalent hotkey architecture to the (very good) one you find in Swing? How does it work in the case of a JavaFX text control object? I thought all might become clear if I took a look at javafx.scene.control.TextInputControl . Also tried googling of course. But I'm none the wiser. Presumably there must be a source of the minimal keystroke bindings you need when editing text? Is it similarly

Access selected text within a Hotkey object

拥有回忆 提交于 2019-12-13 17:45:54
问题 Is it possible to grab user's selected text within Hotkey 's scope? Defined in Addon/lib/main.js : var showHotKey = Hotkey({ combo: "accel-f1", onPress: function() { Addon.saveText(window.getSelection().toString()); } }); Error .. error: Addon: An exception occurred. ReferenceError: window is not defined resource://org/Addon/lib/main.js 14 Traceback (most recent call last): File "resource://gre/modules/commonjs/sdk/keyboard/observer.js", line 39, in handleEvent this._emit(event.type, event,

How can I type “{0}” more quickly in Visual Studio?

痴心易碎 提交于 2019-12-13 09:44:35
问题 In C#, it's common to have to type {0} , {1} , etc. when formatting strings with string.Format() or Console.WriteLine(). Considering its frequency, it's an awkward set of key strokes. But despite my searches, I couldn't find any sort of shorthand or hotkey to automatically insert it in Visual Studio. Has anyone figured out something to expedite the process? 回答1: You can create the following command (C#) with my Visual Commander extension to insert text and then assign a keyboard shortcut to

C# Forms - Buttons with multiple texts, and image

萝らか妹 提交于 2019-12-13 09:34:17
问题 I want to create buttons with two texts: one left (text label itself) and one right (hotkey) aligned, and possibly an image. The screenshot below is from a similar application (not mine!) It would be nice to support multiple lines of text, just like buttons F1-F6 in the image, but I can live without that. I don't need the "always-pressed state" of F8 button. I'm using C# and windows forms. EDIT: Apparently this is very simple in WPF. Never did anything in WPF, but will surely take a look. 回答1

Detect which Hot keys is being pressed

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:44:15
问题 How can I detect which key combination is being pressed? For example I want to recognize Back and Menu button being pressed simultaneously or any key combination. I would like to open my application on the basis on which key is being pressed. 回答1: I did a simple research and found this solution and it may work. You can detect Menu key pressed by the following code. public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent