bklare

Does anyone know how to create a background process i.e., I want the process to not be visible in the taskbar, or system tray. I am starting the process using System.Diagnostics.Process.Start().

If there is not a way to start a process this way, then does anyone know a message number I can send throught the User32.dll SendMessage() API to achieve the same result



Re: Visual C# General Create Background Process

vtortola

You can use the asynchronous programming model.

If you want something more simple, you can use the BackgroudWorker.

Regards.






Re: Visual C# General Create Background Process

bklare

Thank you for your reply, however your suggestion uses threads, which is not relevant. I have a program, a process, that is already built that simply needs to run in the background. I am quite confident that a solution exists, I just do not know if the .Net SDK has an API for this.

To reiterate what I am trying to accomplish, I need a process to be running but not visible to the user, with the exception of in the Task Manager or similar.






Re: Visual C# General Create Background Process

vtortola

Ahm! ok.

If you create a application with a no-visible form with the "ShowInTaskbar" set to false ... the app is not visible Stick out tongue

Regards.






Re: Visual C# General Create Background Process

Peter Ritchie

What do you mean by a "background process" Do you simply want to create a new program with no visible UI Or is there a specific program you want to run without showing a console window




Re: Visual C# General Create Background Process

bklare

Thanks again for the responses.

This is a specific program I am trying to run without showing a console window. It is a C++ .Net console app being launched by another process (a GUI). The console app is a local server that processes the GUI client. I just want the console app to run without being visible to the user.

vtortola, your idea seems nice, but I could not find any project settings for "ShowInTaskbar", because it is a console app. If they do exist then that may work, but I would prefer not to have to compile the console app ashidden because sometimes it may be run without being hidden.

I have a feeling that a solution may lie in using the user32 API ( I know, different forum), but I am also wondering if the same can be done in the .Net SDK.

As I am reading this, I realize this may be in the wrong forum, but the GUI that is launching the console app is a C# app.






Re: Visual C# General Create Background Process

Peter Ritchie

You could try using the ProcessWindowStyle.Hidden value. For examle:

Code Snippet

ProcessStartInfo startInfo = new ProcessStartInfo();

startInfo.FileName = "Myapplication.exe";

startInfo.WindowStyle = ProcessWindowStyle.Hidden;

Process process = new Process();

process.StartInfo = startInfo;

process.Start();






Re: Visual C# General Create Background Process

bklare

That is exactly what I needed! Thanks.