This question already has answers here:
VB.NET Detecting Keypress While Minimized
(3 answers)
Closed 8 years ago.
I want to assign F keys always to my program
I assigned F1 key to maximize my program
let say I open Firefox and my program minimized so when I press F1 key I want to maximize my program
What you are looking for is called a Global Keyboard Hook. Basically your program will ask the operating system to notify it whenever keys are pressed. Support for this isn't built directly in to .net, but it can be accessed using p/invoke.
There is a very good example of it, along with VB.NET source code in this stack overflow question: How to listen keyboard in background and fire keystrokes on demand?
Related
This question already has answers here:
Background thread with QThread in PyQt
(7 answers)
Example of the right way to use QThread in PyQt?
(3 answers)
In PyQt, what is the best way to share data between the main window and a thread
(1 answer)
Closed 4 months ago.
I set up a GUI and so far, everything works as it should, except of one thing. There is a button which means "Start" and calls a function/algorithm. Within this function, some inputs are needed from the user (via a QLineEdit) and here begins the trouble.
What I want to have is the following:
User enters a number into the QLineEdit and presses a button (let's call it Next) so the algorithm can proceed.
At the moment, the algorithm simply takes the number, entered in this specific QLineEdit before the start button was pressed, for each step. And the problem is, I'm not able to enter a number again until the algorithm finished.
From my understanding the issue lies in the fact that the GUI is not responsive when entering the algorithm. How could I do that?
The next button doesn't work, yet, because I don't know how to do so.
This question already has answers here:
Detect any key press, including modifier keys, on OS X
(2 answers)
Closed 3 years ago.
How can I create a keyboard shortcut only for the cmd key? UIKeyCommand's initializer also expects a nonnull regular key (input) along the modifier flag(s) (cmd in my case) so it doesn't work when passing nil.
I know it's possible as Paste and Slack are doing the same, but I don't have experience with macOS to figure it out.
This is not a duplicate of Detect any key press, including modifier keys, on OS X because that question is weirdly worded and it ranks low on Google. I searched for days for an answer to this question and couldn't find any, so I'd leave this open for easier finding.
You can achieve this using:
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged handler:^NSEvent *(NSEvent *incomingEvent) {
if (incomingEvent.modifierFlags & NSEventModifierFlagCommand) {
NSLog(#"command key down");
}
return incomingEvent;
}];
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Display Soft Input Panel (SIP) on WP7 programmatically
I'm doing an application that must display the keyboard, and could not discover an event to perform this function in c #.
I would be of much help you can acesorar this.
You can set focus to TextBox and keyboard will show:
TextBox1.Focus();
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Cocoa: I've got my user's input - Now what?
I am trying to use nswindows controller to handle user inputs during the program execution.
I am able to get the user input in a nstextfield but when i am clicking on the ok or cancel button, their respective IBAction methods are getting executed and the control is not getting returned to the previous execution place that should execute after the nswindowcontroller gets the user input. Please suggest me a way to get over this.
Thanks
What do you mean by "the previous execution place"? Cocoa apps are event-driven, you are pretty much always just responding to user input.
What is your app doing?
This question already has an answer here:
Is there a Windows API hook for "this application wants attention"?
(1 answer)
Closed 9 months ago.
I can use "FlashWindowEx" to make a window flash in the taskbar, but what can I call to determine if that has been done to a window? Is there a flag that gets set somewhere that I can query?
It's seems that such thing is not possible.
However, there may be workarounds.
For example, you may keep a boolean variable "flash = false". Then set it to "true" when you call FlashWindowEx and set to "false" in the situations in which applications typically gain focus.
References:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1846008&SiteID=1