/// <summary> /// Allocate a new console for the calling process. /// </summary> public static void AllocConsole() { if (!WinCon.AllocConsole()) { throw new IOException("Unable to allocate console", Marshal.GetLastWin32Error()); } SetupControlHandler(); }