public static void ShowConsole() { var handle = PInvokes.GetConsoleWindow(); if (handle == IntPtr.Zero) { PInvokes.AllocConsole(); return; } PInvokes.ShowWindowAsync(handle, PInvokes.SW.Show); }
public static void InitialConsole(bool disableCloseButton = false) { PInvokes.AllocConsole(); var handle = PInvokes.GetConsoleWindow(); #if !DEBUG PInvokes.ShowWindowAsync(handle, PInvokes.SW.Hide); if (disableCloseButton) { DisableCloseButton(); } #endif SetConsoleCtrlHandler(handlerDelegate, true); }