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

Re: [2.0] Hide a console application by Kevin

Kevin
Fri Oct 20 08:23:01 CDT 2006

Unless your app starts the process, the window cannot be hidden.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Shooter
http://unclechutney.blogspot.com

A man, a plan, a canal, a palindrome that has.. oh, never mind.

"Freddyboy" <Freddyboy@discussions.microsoft.com> wrote in message
news:6C3F47C6-EC69-491C-8F4E-B3CF2A49DB5F@microsoft.com...
> 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



Re: [2.0] Hide a console application by Chris

Chris
Fri Oct 20 08:53:29 CDT 2006

Maybe you could build your application as a Windows Service instead?
http://msdn2.microsoft.com/en-us/library/zt39148a.aspx

--
Chris Fulstow
MCP, MCTS
http://chrisfulstow.blogspot.com/


Freddyboy wrote:
> 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


Re: [2.0] Hide a console application by Freddyboy

Freddyboy
Fri Oct 20 09:03:03 CDT 2006

Thanks for your answer Kevin.

"Kevin Spencer" wrote:

> Unless your app starts the process, the window cannot be hidden.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Chicken Salad Shooter
> http://unclechutney.blogspot.com
>
> A man, a plan, a canal, a palindrome that has.. oh, never mind.
>
> "Freddyboy" <Freddyboy@discussions.microsoft.com> wrote in message
> news:6C3F47C6-EC69-491C-8F4E-B3CF2A49DB5F@microsoft.com...
> > 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
>
>
>

Re: [2.0] Hide a console application by Ben

Ben
Fri Oct 20 10:12:52 CDT 2006

"Freddyboy" <Freddyboy@discussions.microsoft.com> wrote in message
news:6C3F47C6-EC69-491C-8F4E-B3CF2A49DB5F@microsoft.com...
> 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.

>
> 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



Re: [2.0] Hide a console application by Michael

Michael
Fri Oct 20 15:14:25 CDT 2006

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.

"Kevin Spencer" <spam@uce.gov> wrote in message
news:eNG2QrE9GHA.4408@TK2MSFTNGP02.phx.gbl...
> Unless your app starts the process, the window cannot be hidden.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Chicken Salad Shooter
> http://unclechutney.blogspot.com
>
> A man, a plan, a canal, a palindrome that has.. oh, never mind.
>
> "Freddyboy" <Freddyboy@discussions.microsoft.com> wrote in message
> news:6C3F47C6-EC69-491C-8F4E-B3CF2A49DB5F@microsoft.com...
>> 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
>
>



Re: [2.0] Hide a console application by Freddyboy

Freddyboy
Mon Oct 23 02:21:02 CDT 2006

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

"Ben Voigt" wrote:

> "Freddyboy" <Freddyboy@discussions.microsoft.com> wrote in message
> news:6C3F47C6-EC69-491C-8F4E-B3CF2A49DB5F@microsoft.com...
> > 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.
>
> >
> > 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
>
>
>