How to open/close console window dynamically from a wpf application?

后端 未结 1 1727
春和景丽
春和景丽 2020-12-05 19:34

I am making a WPF application and I want to release a beta version of the application, for that I am adding a Button named \"debug\" Which will

1条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 20:19

    Do you think now I understood the question?

    [DllImport("Kernel32")]
    public static extern void AllocConsole();
    
    [DllImport("Kernel32")]
    public static extern void FreeConsole();
    
    
    private void button1_Click(object sender, EventArgs e)
    {
        AllocConsole();
        Console.WriteLine("test");
    }
    

    0 讨论(0)
提交回复
热议问题