0

I am making a C# WPF application. I can hide/show the console throught C imported functions (as in Show/Hide the console window of a C# console application). Is there any way to hide the console by overridding the close button ?

Community
  • 1
  • 1
vanna
  • 1,552
  • 5
  • 20
  • 35
  • 3
    Do you really need a console application instead of a WPF application? – Cédric Bignon Jan 29 '13 at 14:41
  • 1
    Get a handle to the console application and call Kill on it. – edocetirwi Jan 29 '13 at 14:42
  • I need the console aside my main WPF app to monitor outputs. I changed my question to be more specific. – vanna Jan 29 '13 at 14:43
  • 1
    @vanna: Seems to be an odd approach. Why don't you stream the output into a listbox? This should look much better and you can handle the visual appearance as you want. – DHN Jan 29 '13 at 15:02

1 Answers1

0

You should consider using Console.SetOut and show the output on a window instead: Console.SetOut

The best approach however is to use some decent logging mechanisms instead of the Console.

Andre
  • 1,228
  • 11
  • 24