Пример #1
0
    static void Main()
    {
        InterceptKeys.SetupHook(KeyDown);
        while (true)
        {
            ConsoleKey key = Console.ReadKey(true).Key;
            Console.WriteLine("ReadKey: " + key);

            if (key == ConsoleKey.Escape)
            {
                break;
            }
        }
        InterceptKeys.ReleaseHook();
    }
Пример #2
0
 /// <summary>
 /// Hook key event on KeyDown press.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="e"></param>
 private void KeyHook(object o, DoWorkEventArgs e)
 {
     InterceptKeys.SetupHook(KeyDown);
     InterceptKeys.ReleaseHook();
 }