j d
j d

Reputation:

ProcessStartInfo.WindowStyle c#

I use the following to start one of my applications

 // Start the process
 ProcessStartInfo startInfo = new ProcessStartInfo(this.exeName);

 startInfo.WindowStyle = ProcessWindowStyle.Minimized;

 controlProcess = System.Diagnostics.Process.Start(startInfo);

The behavior that I see is that if there are no items in my task bar, the above starts my standalone application, by using the property this.exeName to get the path of the application, and the standalone application is seen on the task bar.

If my taskbar has only a few items, the above situation does not happen and my stand alone application is only known when i find it in the task manager, which is what i want and not the scenario described in the above para.

Essentially, I want to start an application and keep it running without displaying its UI, more like pre-load the application, and when user clicks on certain actions, bring the application to focus and enable it so that the user can perform actions

My sample code is from here, to see if this is a feasible solution for my own experimental project

link text

Upvotes: 1

Views: 2000

Answers (2)

Todd
Todd

Reputation: 620

You need to set the ShowInTaskbar property to false on the main form of the application that you are launching. Additionally, you will need to hide the form until a user action requests it to be shown.

You can also add a notifyIcon to the system tray if you want to keep the application somewhat visible.

Upvotes: 2

TheSmurf
TheSmurf

Reputation: 15568

The possibility of doing what you're asking for (pre-load an application) depends entirely on the functionality of the application; you do not independently have this kind of control over a process when starting it.

Upvotes: 1

Related Questions