Export (0) Print
Expand All

Process Constructor

Initializes a new instance of the Process class.

[Visual Basic]
Public Sub New()
[C#]
public Process();
[C++]
public: Process();
[JScript]
public function Process();

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 (Shared in Visual Basic) 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 (Shared in Visual Basic) 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.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Process Class | Process Members | System.Diagnostics Namespace

Show:
© 2014 Microsoft