Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 .

Sorry for the background story (if it's not helpful). I essentially need to know how to show/hide console windows dynamically in c# .

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
362 views
Welcome To Ask or Share your Answers For Others

1 Answer

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");
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...