Redigera

Dela via


Process Constructor

Definition

Initializes a new instance of the Process class.

public:
 Process();
public Process ();
Public Sub New ()

Remarks

If you do not specify the MachineName property, the default is the local computer, (".").

You have two options for associating a new Process component with a process on the computer. The first option is to use the constructor to create the Process component, set the appropriate members of the StartInfo property and call Start to associate the Process with a new system process. The second option is to associate the Process with a running system process by using GetProcessById or one of the GetProcesses return values.

If you use a static overload of the Start method to start a new system process, the method creates a new Process component and associates it with the process.

When the ProcessStartInfo.UseShellExecute property is set to its default value, true, you can start applications and documents in a way that is similar to using the Run dialog box of the Windows Start menu. When ProcessStartInfo.UseShellExecute is false, you can start only executables.

Any executable file that you can call from the command line can be started in one of two ways: by setting the appropriate members of the StartInfo property and calling the Start method with no parameters, or by passing the appropriate parameter to the static Start member.

You can create a Process component by using the constructor, one of the static Start overloads, or any of the GetProcessById, GetProcesses, or GetProcessesByName methods. After you have done so, you have a view into the associated process. This is not a dynamic view that updates itself automatically when the process properties have changed in memory. Instead, you must call Refresh for the component to update the Process property information in your application.

Applies to