using System.Runtime.InteropServices;
public class Win32
{ ///
[DllImport("kernel32.dll")]
public static extern Boolean AllocConsole(); ///
[DllImport("kernel32.dll")]
public static extern Boolean FreeConsole();
}
public Form1()
{
InitializeComponent();
Win32.AllocConsole();
}
}
在需要的地方插入下Code:
Console.WriteLine("Waiting for data..");
參考:http://www.thereforesystems.com/output-to-console-in-windows-forms-application/
參考:http://www.thereforesystems.com/output-to-console-in-windows-forms-application/
沒有留言:
張貼留言