기본카테고리
[C#] 윈폼과 콘솔창을 같이 사용하기 위한 콘솔창 할당하기
DevReff
2016. 9. 10. 16:10
728x90
728x90
SMALL
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
private static extern bool AllocConsole();
private void Frm_Main_Load(object sender, EventArgs e)
{
...
AllocConsole();
...
}
임의의 함수
{
...
AddMessage("테스트");
...
}
private delegate void AddMessageDelegate(string msg);
private void AddMessage(string msg)
{
System.Console.WriteLine(msg);
}
728x90
728x90
LIST