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 essentially show/hide the console window. I am writing appropriate message on the console after each event occurs so This will help users to report back the problem that they are having by looking at the messages on the console .
我正在制作一个WPF应用程序,我想发布一个测试版的应用程序,因为我正在添加一个名为“debug”的按钮,它将基本上显示/隐藏控制台窗口。每次事件发生后我都会在控制台上写相应的消息,这样可以帮助用户通过查看控制台上的消息来报告他们遇到的问题。
Sorry for the background story (if it's not helpful). I essentially need to know how to show/hide console windows dynamically in c# .
对不起背景故事(如果它没用)。我基本上需要知道如何在c#中动态显示/隐藏控制台窗口。
1 个解决方案
#1
25
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");
}
#1
25
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");
}