0

I am doing an console application that is working with other apps. While the code works with the other apps the console does not have the focus so the console does not record the keyboard ... I would like to be able to set a "watcher" in background on the console app to pause (with space) and stop (with escape) while the code does what it have to do.

Grez
  • 59
  • 8

1 Answers1

0

You could just check for key presses like this:

public static bool System.Windows.Input.IsKeyDown (System.Windows.Input.Key key);

You can find it in the assembly PresentationCore.dll.

But it isn'r really elegant and you could miss some key presses. But maybe this is enough for you.

If not, this answer might help you. It would only work on windows though.