[2.0] Hide a console application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a console application and I would like to hide it when it's running.
Of course I took a look into the StartInfo property of the Process Class
(CreateNoWindow, WindowsStyle) but when I start my application, the dos
windows is still visible.

Process p = Process.GetCurrentProcess();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

This application is started by an other program which is not developped in
..NET so I can't create a ProcessStartInfo object and set CreateNoWindow and
WindowsStyle. Anyway I haven't source code.

Does someone have an idea or the solution for me ?

Thanks

Fred
 
Freddyboy said:
Hi, I have a console application and I would like to hide it when it's
running.
Of course I took a look into the StartInfo property of the Process Class
(CreateNoWindow, WindowsStyle) but when I start my application, the dos
windows is still visible.

If you don't need a console window, make it not a console application. A
Forms app isn't required to actually show a Form or run the event loop.
 
Iterate through the process list and get your target process. Then use API
calls to get the window handle to the process and hide it.

Mike.
 
Thanks all for your answers.
In fact that's rigth I changed my console application to a "form
application" without start a "form" and my application works like I want.

Thanks

Best Regards

Fred
 
Back
Top