none
Create Background Process

    Question

  • 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?
    Thursday, May 17, 2007 7:55 PM

Answers

  • 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();

     

     

    Friday, May 18, 2007 3:09 PM
    Moderator

All replies

  • You can use the asynchronous programming model.

     

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

     

    Regards.

    Thursday, May 17, 2007 10:07 PM
  • 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.

    Thursday, May 17, 2007 10:54 PM
  • 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.

    Thursday, May 17, 2007 11:22 PM
  • 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?
    Friday, May 18, 2007 12:03 AM
    Moderator
  • 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.

    Friday, May 18, 2007 2:36 PM
  • 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();

     

     

    Friday, May 18, 2007 3:09 PM
    Moderator
  • That is exactly what I needed! Thanks.
    Friday, May 18, 2007 3:18 PM
  • Many Thanks...This works for me also..
    Wednesday, April 19, 2017 5:56 AM