Closed asim1337 closed 6 years ago
I'm doing the following in my code to detect shift + caps lock and ctrl+caps lock.
public MyClass()
{
KeyboardListener = new KeyboardHookListener(new GlobalHooker()) {Enabled = true};
KeyboardListener.KeyDown += KeyboardListener_KeyDown;
}
private void KeyboardListener_KeyDown(object sender, KeyEventArgs e)
{
// Holding down Shift and CapsLock, not already suspending toggle
if (e.Shift && e.KeyValue == 20){...}
// Holding down Control and Capslock, suspending of toggle active
else if (e.Control && e.KeyValue == 20){...}
}
See new feature Detecting Key Combinations and Sequences
I can't figure out the most obvious function.. How can i recognize key combinations? I tried:
private void M_GlobalHook_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)0x41 && e.KeyChar == (char)0xA2) { MessageBox.Show("Left Ctrl + A pressed!"); } }