I want a console application to run as long as i press a specified key, even outside of the programm. For example the programm is running in the background und when i am writing something e.g. in word and press a specific key, the console application does something.
I started with this:
static void Main(string[] args)
{
ConsoleKeyInfo keyinfo;
do
{
keyinfo = Console.ReadKey();
//Do something
}
while (keyinfo.Key != ConsoleKey.F10);
}
But the problem here is, that it stops and waits for a key pressed until it keeps going. I want to run it in the background and always checking when i am pressing a specific key.
Any solutions?