close
這一篇其實算是補充篇,
有些人應該像我一樣寫習慣了,會希望Debug的時候有個地方能夠讓我看到輸出的結果,
叫出Console的方式其實蠻簡單的,
代碼如下 :
public frmMain()
{
InitializeComponent();
AllocConsole();
Console.Beep();
ConsoleColor oriColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("* Don't close this console window or the application will also close.");
Console.WriteLine();
Console.ForegroundColor = oriColor;
}
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
static extern bool AllocConsole();
[System.Runtime.InteropServices.DllImport("Kernel32")]
public static extern void FreeConsole();
文章標籤
全站熱搜