0

Source: How do I detect keyPress while not focused?

I have read a tutorial about how to register a key, even when the window is not in the focus. This really hepled me, but I would like to check, if the Control (Ctrl) -Key is pressed as well at the same moment.

I tried this, but it didn't help:

if (ModifierKeys == Keys.Control)
{
     //do stuff...
}

To be exactly, it required both Control-Keys (left and right) to be pressed at that moment to trigger...

Community
  • 1
  • 1
  • This has been covered close to a half dozen times on Stack Overflow alone. – Yuck May 30 '14 at 13:37
  • It depends, do you require the window _not to be focused_? – Tzah Mama May 30 '14 at 13:39
  • The thing is, I don't have KeyEventArgs e... The method has no parameters. – Matthias Thomann May 30 '14 at 13:44
  • That's not a valid duplicate, This question mentions checking for both control keys potentially without window focus, while the duplicate checks for Ctrl+Shift in a key down event. See [here](http://stackoverflow.com/questions/3035111/can-i-determine-whether-a-ctrl-key-press-is-left-ctrl-or-right-ctrl) for left vs right ctrl – James May 30 '14 at 13:54

0 Answers0