24 lines
654 B
C#
24 lines
654 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace GUIConsole.ConPTY.Native
|
|
{
|
|
/// <summary>
|
|
/// PInvoke signatures for Win32's Console API.
|
|
/// </summary>
|
|
static class ConsoleApi
|
|
{
|
|
[DllImport("kernel32.dll", SetLastError = true)]
|
|
internal static extern bool SetConsoleCtrlHandler(ConsoleEventDelegate callback, bool add);
|
|
internal delegate bool ConsoleEventDelegate(CtrlTypes ctrlType);
|
|
|
|
internal enum CtrlTypes : uint
|
|
{
|
|
CTRL_C_EVENT = 0,
|
|
CTRL_BREAK_EVENT,
|
|
CTRL_CLOSE_EVENT,
|
|
CTRL_LOGOFF_EVENT = 5,
|
|
CTRL_SHUTDOWN_EVENT
|
|
}
|
|
}
|
|
}
|