Share via


Trap Ctrl+C

In Windows, you use SetConsoleCtrlHandler to trap Ctrl+C.

Comments

  • Anonymous
    June 15, 2005
    And in .NET Framework V2 you can use:

    Console.TreatControlCAsInput = false;

    Then use:
    Console.CancelKeyPress += new
    ConsoleCancelEventHandler(myHandler);

    with your own handler.
  • Anonymous
    August 29, 2006