i have a console application project. it has gui (winforms) and console window which is used as debug console (application’s run log).
now, if i have got debug disabled i hide console window with ShowWindow native call.
the problem is: after i close application window by pressin the X button or by quitting it (Application.Exit()) i have a zombie console process.
if i close console on the very begining by Environment.Exit(0) the form is not been showed.
i have tried to modify forms Closed event by adding there Environment.Exit(0), but that did not work which means that there still remains a zombie console process.
how can i close console window on application exit?
If it is a console application, the console will not “close” until the process terminates. So you just simply need to close the form normally… assuming you “opened” it like you should.
To “open” the form, you need to run it. Run it by calling
Application.Run(Form)(the same way you would initialize an actual form project). Since a console is allocated to your process, your form may write toConsole.Outand you should see what you write.