.net - How to set HotKey system-wide in C# -
V3 has a function named HotKeySet . It sets a hotkey that when pressed the user function Makes a call. This system is a hot hotkey, which means that when the hotkey is set, the key can not be used for anything else.
Actually, I would like to capture esc or some other key like $
, `
, etc. and when the user It presses anywhere, even if it should be told outside of the app too.
For example, I am like HotKeySet ({ESC}) inside a loop and when this is done, then the program will wait for that key to be pressed first.
public static zero work () (while true) {string task = null; Lock (locker) if (function calculation> 0) {task = taskss.Dequeue (); If (task == zero) {return; }} If (work! = Null) {//MessageBox.Show(- Performance: "+ Work); Program.mainAnnounceWindow.setLogTextBox (function); Program.mainAnnounceWindow.setLogTrayTip (function); Program.windowStateChange (" Show " ); // Set Here Set the Hotkey (`); // When it is pressed, wait for the hotkey to press ... Thread some stuff. Sleep (5000); // Simulate work ... Program. Windstat Changes ("Hide");} and {wh.WaitOne (); // No More Fun - Wait for an Indication}}}
come Need to take the Pinvoke.net, is a good example.
Comments
Post a Comment