I wonder is there a way, to handle key event if my application not in focus.
For example, I create a small app. It has a transaparent background. When I run my app via Xcode(run option), it is in focus and handle key events. But if I click anywhere, focus lost and key events doesn't handled. All I need is handle key event even if my application not in focus(with transaparent background), and if send key events to other windows(in focus), if this key events won't needed for my application. Dropl is application, that doing just what I want. But I don't have the source.
Ok, I solwed my problem using DDHotKeyExample from https://github.com/davedelong/DDHotKey
Related
The user will type in a datagridview the shortcuts he would like to assign to a couple of operations. I tried to use KeyDown event when the cell is in edit mode.
However I want my control to be able to detect in the same event handler the Control key typed alone, or the Control key used as a modifier (same with Shift and Alt).
This causes a problem since KeyDown fires up when Control is down before the other key I am combining it with is also down. Obviously the event handler doesn't know if the user intends on pressing another key after the Control key.
Right now I solved this issue by using KeyUp, but this caused other headaches when for example the user types in CTRL+P, releases P, which fires the correct event, but then the user releases Ctrl which fires a new KeyUp event which I had to find a way to ignore.
There must be a cleaner way to handle this?
I am able to open a new window by clicking on a button in another window, but my requirement is that I should be able to listen to the events generated from the other window.
Can anybody help me? How can I register the events from one window and listen to them in the other, so that intercommunication can happen?
My answer would be that you shouldn't. Register your listeners in a common controller--that way, whatever events are fired by either window can be captured by the controller, and the controller can decide what needs to happen to what window in what circumstance.
I use TIBCO PageBus (http://developer.tibco.com/pagebus/default.jsp) for inter application events within my ExtJs applications. It is a JavaScript event bus. For instance, similar to what you describe, I have an editor window, which has a button to display a preview window. The editor window on a save, raises a update content event on the page bus, which the preview window subscribes to, upon receiving the event it refreshes the preview.
One of the advantages of this approach is that many clients can subscribe to events, if you have a complex application.
This is an auto talker that i created, but it isn't very convenient to click on start and stop when the text is being typed at 10 milliseconds. So i wanted to create a key that when pressed starts the auto typer, and also stops it. I have a box where the user can press a key to assign to start and stop the auto typing. What code would i put for clicking on assign? I want assign to: get key from textbox5.text and use it as the shortcut key to start spamming. The key would be pressed when the Interface for the spam bot is minimized, so i can't use "&Spambot" for S to be the shortcut key.
Any help would be appreciated.
Please click on the link below to see image
http://s16.postimg.org/6xdxtjvg5/Interface.png
I successfully used some methods to read the numkey state, started my stuff when it is turned on, and stop it when it is turned off again, maybe you will like that solution.
If Control.IsKeyLocked(Keys.NumLock) Then ...
your alternative would be to 1. use an keyDown event (i think it gave more information about pressed keys than key pressed event), then store it in a local variable
And finally using an external dll to figure out if any key is pressed anywhere in windows. And if, then compare if it is the correct key, and then trigger whatever you want to trigger.
Basically i am creating a vbnet system software. I want to create a shortcut key to lock the system with out affecting the windows explorer (just my system only). Is it possible to create one for that? Or let's say create a procedure that triggers anywhere whether the focus is on a control, on a form (whether shown as normal or modal), or on any other that has the focus on it.
I just need an idea. Thank you.
I think you could use hotkey registration to do it.
Here is one of a few existing walk throughs on accessing user32.dll to register a global hotkey
I think the key for you will be where to register the hotkey and make sure to unregister it when your application closes.
I need to handle a Tab key press in my application. In some conditions I want to do some stuff in my handler and suppress further event handling and in other cases I just skip and let other standard handlers to handle this event.
Here is my very simple app where I'm trying to do it.
https://github.com/prudnikov/TestGlobalShortcut/blob/master/TestGlobalShortcut/AppDelegate.m
It catches tab press but it always suppresses further event handling. I mean when I press Tab in the text editor the tab key is not inserted.
Can you advise what should I do to propagate standard event handlers?
I don't think you can do that using RegisterEventHotKey. But unless you need to receive the tab key when your app is not frontmost, you should not be using RegisterEventHotKey. Use a regular Carbon Event handler, or use Cocoa event handling techniques.