System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.ComponentModel.Component System.ComponentModel.DefaultEvent("Exited") System.ComponentModel.DefaultProperty("StartInfo") System.ComponentModel.Designer("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.Diagnostics.MonitoringDescription("Represents a system process")

Starting with the .NET Framework version 2.0, the ability to reference performance counter data on other computers has been eliminated for many of the .NET Framework methods and properties. This change was made to improve performance and to enable non-administrators to use the class. As a result, some applications that did not get exceptions in earlier versions of the .NET Framework may now get a . The methods and properties affected are too numerous to list here, but the exception information has been added to the affected member topics.

A component provides access to a process that is running on a computer. A process, in the simplest terms, is a running application. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the code of the process, including parts currently being executed by another thread.

The component is a useful tool for starting, stopping, controlling, and monitoring applications. Using the component, you can obtain a list of the processes that are running, or you can start a new process. A component is used to access system processes. After a component has been initialized, it can be used to obtain information about the running process. Such information includes the set of threads, the loaded modules (.dll and .exe files), and performance information such as the amount of memory the process is using.

A 32-bit processes cannot access the modules of a 64-bit process. If you try to get information about a 64-bit process from a 32-bit process, you will get a exception.

If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

The process component obtains information about a group of properties all at once. After the component has obtained information about one member of any group, it will cache the values for the other properties in that group and not obtain new information about the other members of the group until you call the method. Therefore, a property value is not guaranteed to be any newer than the last call to the method. The group breakdowns are operating-system dependent.

A system process is uniquely identified on the system by its process identifier. Like many Windows resources, a process is also identified by its handle, which might not be unique on the computer. A handle is the generic term for an identifier of a resource. The operating system persists the process handle, which is accessed through the property of the component, even when the process has exited. Thus, you can get the process's administrative information, such as the (usually either zero for success or a nonzero error code) and the . Handles are an extremely valuable resource, so leaking handles is more virulent than leaking memory.

This class contains a link demand and an inheritance demand at the class level that applies to all members. A is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.

Provides access to local and remote processes and enables you to start and stop local system processes.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

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

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

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

  When the 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 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 property and calling the method with no parameters, or by passing the appropriate parameter to the static member.

  You can create a component by using the constructor, one of the static overloads, or any of the , , or 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 for the component to update the property information in your application.

  Initializes a new instance of the class.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Base process priority.")
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  The of the process is the starting priority for threads created within the associated process. You can view information about the base priority through the System Monitor's Priority Base counter.

  Based on the time elapsed or other boosts, the operating system can change the base priority when a process should be placed ahead of others.

  The property lets you view the starting priority assigned to a process. However, because it is read-only, you cannot use the to set the priority of the process. To change the priority, use the property. The is viewable using the System Monitor, while the is not. Both the and the can be viewed programmatically. The following table shows the relationship between values and values.

  BasePriority

  PriorityClass

  4

  8

  13

  24

  Gets the base priority of the associated process.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void

  The stream can be read synchronously or asynchronously. Methods such as , , and perform synchronous read operations on the error output stream of the process. These synchronous read operations do not complete until the associated writes to its stream, or closes the stream.

  In contrast, starts asynchronous read operations on the stream. This method enables the designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.

  Follow these steps to perform asynchronous read operations on for a :

  Set to false.

  Set to true.

  Add your event handler to the event. The event handler must match the delegate signature.

  Start the .

  Call for the . This call starts asynchronous read operations on .

  When asynchronous read operations start, the event handler is called each time the associated writes a line of text to its stream.

  You can cancel an asynchronous read operation by calling . The read operation can be canceled by the caller or by the event handler. After canceling, you can call again to resume asynchronous read operations.

  You cannot mix asynchronous and synchronous read operations on a redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. For example, do not follow with a call to on the stream, or vice versa. However, you can read two different streams in different modes. For example, you can call and then call for the stream.

  Begins asynchronous read operations on the redirected stream of the application.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void

  The stream can be read synchronously or asynchronously. Methods such as , , and perform synchronous read operations on the output stream of the process. These synchronous read operations do not complete until the associated writes to its stream, or closes the stream.

  In contrast, starts asynchronous read operations on the stream. This method enables a designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.

  Follow these steps to perform asynchronous read operations on for a :

  Set to false.

  Set to true.

  Add your event handler to the event. The event handler must match the delegate signature.

  Start the .

  Call for the . This call starts asynchronous read operations on .

  When asynchronous read operations start, the event handler is called each time the associated writes a line of text to its stream.

  You can cancel an asynchronous read operation by calling . The read operation can be canceled by the caller or by the event handler. After canceling, you can call again to resume asynchronous read operations.

  You cannot mix asynchronous and synchronous read operations on a redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. For example, do not follow with a call to on the stream, or vice versa. However, you can read two different streams in different modes. For example, you can call and then call for the stream.

  Begins asynchronous read operations on the redirected stream of the application.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void

  starts an asynchronous read operation on the stream. ends the asynchronous read operation.

  After canceling, you can resume the asynchronous read operation by calling again.

  When you call , all in-progress read operations for are completed and then the event handler is disabled. All further redirected output to is saved in a buffer. If you re-enable the event handler with a call to , the saved output is sent to the event handler and asynchronous read operations resume. If you want to change the event handler before resuming asynchronous read operations, you must remove the existing event handler before adding the new event handler:

  `// At this point the DataReceivedEventHandler(ErrorHandler1) // has executed a CancelErrorRead. // Remove the prior event handler. process.ErrorDataReceived -= new DataReceivedEventHandler(ErrorHandler1); // Register a new event handler. process.ErrorDataReceived += new DataReceivedEventHandler(ErrorHandler2); // Call the corresponding BeginErrorReadLine. process.BeginErrorReadLine();`

  You cannot mix asynchronous and synchronous read operations on the redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. If you cancel an asynchronous read operation on and then need to read from the stream again, you must use to resume asynchronous read operations. Do not follow with a call to the synchronous read methods of such as , , or .

  Cancels the asynchronous read operation on the redirected stream of an application.

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void

  starts an asynchronous read operation on the stream. ends the asynchronous read operation.

  After canceling, you can resume asynchronous read operations by calling again.

  When you call , all in-progress read operations for are completed and then the event handler is disabled. All further redirected output to is saved in a buffer. If you re-enable the event handler with a call to , the saved output is sent to the event handler and asynchronous read operations resume. If you want to change the event handler before resuming asynchronous read operations, you must remove the existing event handler before adding the new event handler:

  `// At this point the DataReceivedEventHandler(OutputHandler1) // has executed a CancelOutputRead. // Remove the prior event handler. process.OutputDataReceived -= new DataReceivedEventHandler(OutputHandler1); // Register a new event handler. process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler2); // Call the corresponding BeginOutputReadLine. process.BeginOutputReadLine();`

  You cannot mix asynchronous and synchronous read operations on the redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. If you cancel an asynchronous read operation on and then need to read from the stream again, you must use to resume asynchronous read operations. Do not follow with a call to the synchronous read methods of such as , , or .

  Cancels the asynchronous read operation on the redirected stream of an application.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The method causes the process to stop waiting for exit if it was waiting, closes the process handle, and clears process-specific properties. does not close the standard output, input, and error readers and writers in case they are being referenced externally.

  The method calls . Placing the object in a using block disposes of resources without the need to call .

  Frees all the resources that are associated with this component.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  When a process is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately.

  Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination, and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces.

  You can call and only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers.

  Closes a process that has a user interface by sending a close message to its main window.

  true if the close message was successfully sent; false if the associated process does not have a main window or if the main window is disabled (for example if a modal dialog is being shown).

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added

  Release all resources used by this process.

  true to release both managed and unmanaged resources; false to release only unmanaged resources.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DefaultValue(false)
  System.Diagnostics.MonitoringDescription("Check for exiting of the process to raise the apropriate event.")
  System.Boolean To be added: an object of type 'bool'

  The property indicates whether the component should be notified when the operating system has shut down a process. The property is used in asynchronous processing to notify your application that a process has exited. To force your application to synchronously wait for an exit event (which interrupts processing of the application until the exit event has occurred), use the method.

  If you are using Visual Studio and double-click a component in your project, an event delegate and event handler are automatically generated. Additional code sets the property to false. You must change this property to true for your event handler to be executed when the associated process exits.

  When an associated process exits after being shut down by the operating system either through a normal or abnormal termination, the operating system notifies each process component to which the process was associated, as long as the component's value is true. If a component started the process, the component can then access the administrative information for the associated process, which is still being stored by the operating system. Such information includes the , and the .

  After the associated process exits, the of the component no longer points to an existing process resource. Instead, it can be used only to access the operating system's information about the process resource. The operating system is aware that there are handles to exited processes that have not been released by components, so it keeps the and information in memory.

  There is a cost associated with watching for a process to exit. If is true, the event is raised when the associated process terminates. The procedures that you have specified for the event run at that time.

  Sometimes, your application starts a process but does not need to be notified of its closure. For example, your application can start Notepad to allow the user to perform text editing, but make no further use of the Notepad application. You can choose to not be notified when the process exits, because it is not relevant to the continued operation of your application. Setting to false saves system resources.

  Gets or sets whether the event should be raised when the process terminates.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void

  Some operating system processes run in a special mode. Attempting to read properties of or attach to these processes is not possible unless you have called on the component. Call when you no longer need access to these processes that run in special mode.

  Puts a component in state to interact with operating system processes that run in a special mode by enabling the native property SeDebugPrivilege on the current thread.

- Event
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(true)
  System.Diagnostics.MonitoringDescription("Raised when it receives error data")
  System.Diagnostics.DataReceivedEventHandler

  The event indicates that the associated process has written to its redirected stream.

  The event only occurs during asynchronous read operations on . To start asynchronous read operations, you must redirect the stream of a , add your event handler to the event, and call . Thereafter, the event signals each time the process writes a line to the redirected stream, until the process exits or calls .

  The application that is processing the asynchronous output should call the method to ensure that the output buffer has been flushed.

  Occurs when an application writes to its redirected stream.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The exit code of the process.")
  System.Int32 To be added: an object of type 'int'

  Use to get the status that the system process returned when it exited. You can use the exit code much like an integer return value from a main() procedure.

  The value for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process.

  Developers usually indicate a successful exit by an value of zero, and designate errors by nonzero values that the calling method can use to identify the cause of an abnormal process termination. It is not necessary to follow these guidelines, but they are the convention.

  If you try to get the before the process has exited, the attempt throws an exception. Examine the property first to verify whether the associated process has terminated.

  When standard output has been redirected to asynchronous event handlers, it is possible that output processing will not have completed when returns true. To ensure that asynchronous event handling has been completed, call the overload that takes no parameter before checking .

  You can use the or the method to cause an associated process to exit.

  There are two ways of being notified when the associated process exits: synchronously and asynchronously. Synchronous notification relies on calling the method to pause the processing of your application until the associated component exits. Asynchronous notification relies on the event. When using asynchronous notification, must be set to true for the component to receive notification that the process has exited.

  Gets the value that the associated process specified when it terminated.

- Event
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Category("Behavior")
  System.Diagnostics.MonitoringDescription("Raised when this process exits.")
  System.EventHandler

  The event indicates that the associated process exited. This occurrence means either that the process terminated (aborted) or successfully closed. This event can occur only if the value of the property is true.

  There are two ways of being notified when the associated process exits: synchronously and asynchronously. Synchronous notification relies on calling the method to pause the processing of your application until the associated component exits. Asynchronous notification relies on the event. In either case, must be set to true for the component to receive notification that the process has exited.

  When the operating system shuts down a process, any process component that is waiting for an exit is notified. The component can then access the associated process information that is still resident in the operating system memory (such as property) by using the handle that it has to the process.

  Because the associated process has exited, the property of the component no longer points to an existing process resource. Instead, it can be used only to access the operating system's information about the process resource. The system is aware of handles to exited processes that have not been released by components, so it keeps the and property information in memory until the component specifically frees the resources.

  Even if you have a handle to an exited process, you cannot call again to reconnect to the same process. Calling automatically releases the associated process and connects to a process with the same file but an entirely new .

  For more information about the use of the event in Windows Forms applications, see the property.

  Occurs when a process exits.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The exit time of the process.")
  System.DateTime To be added: an object of type 'DateTime'

  If the process has not terminated, attempting to retrieve the property throws an exception. Use before getting the property to determine whether the associated process has terminated.

  Gets the time that the associated process exited.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process

  Use this method to create a new instance and associate it with the process resource on the local computer.

  Like the similar , , and methods, associates an existing resource with a new component.

  Gets a new component and associates it with the currently active process.

  A new component associated with the process resource that is running the calling application.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process ``

  Use this method to create a new component and associate it with a process resource on the local computer. The process resource must already exist on the computer, because does not create a system resource, but rather associates a resource with an application-generated component. A process can be retrieved only for a process that is currently running on the computer. After the process terminates, throws an exception if you pass it an expired identifier.

  On any particular computer, the identifier of a process is unique. returns one process at most. If you want to get all the processes running a particular application, use . If multiple processes exist on the computer running the specified application, returns an array containing all the associated processes. You can query each of these processes in turn for its identifier. The process identifier can be viewed in the Processes panel of the Windows Task Manager. The PID column displays the process identifier that is assigned to a process.

  Returns a new component, given the identifier of a process on the local computer.

  A component that is associated with the local process resource identified by the parameter.

  The system-unique identifier of a process resource.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO("There is no support for retrieving process information from a remote machine")
  System.Diagnostics.Process `` ``

  Use this method to create a new component and associate it with a process resource on a remote computer on the network. The process resource must already exist on the specified computer, because does not create a system resource, but rather associates a resource with an application-generated component. A process can be retrieved only for a process that is currently running on the computer. After the process terminates, throws an exception if you pass it an expired identifier.

  On any particular computer, the identifier of a process is unique. returns one process at most. If you want to get all the processes running a particular application, use . If multiple processes exist on the computer running the specified application, returns an array containing all the associated processes. You can query each of these processes in turn for its identifier. The process identifier can be viewed in the Processes panel of the Windows Task Manager. The PID column displays the process identifier that is assigned to a process.

  If you do not specify a , the local computer is used. Alternatively, you can specify the local computer by setting to the value "." or to an empty string ("").

  Returns a new component, given a process identifier and the name of a computer on the network.

  A component that is associated with a remote process resource identified by the parameter.

  The system-unique identifier of a process resource. The name of a computer on the network.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process[]

  Use this method to create an array of new components and associate them with all the process resources on the local computer. The process resources must already exist on the local computer, because does not create system resources but rather associates resources with application-generated components. Because the operating system itself is running background processes, this array is never empty.

  If you do not want to retrieve all the processes running on the computer, you can restrict their number by using the or method. creates a component that is associated with the process identified on the system by the process identifier that you pass to the method. creates an array of components whose associated process resources share the executable file you pass to the method.

  Creates a new component for each process resource on the local computer.

  An array of type that represents all the process resources running on the local computer.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO("There is no support for retrieving process information from a remote machine")
  System.Diagnostics.Process[] ``

  Use this method to create an array of new components and associate them with all the process resources on the specified (usually remote) computer. The process resources must already exist on the local computer, because does not create system resources but rather associates resources with application-generated components. Because the operating system itself is running background processes, this array is never empty.

  If you do not want to retrieve all the processes running on the computer, you can restrict their number by using the or method. creates a component that is associated with the process identified on the system by the process identifier that you pass to the method. creates an array of components whose associated process resources share the executable file you pass to the method.

  This overload of the method is generally used to retrieve the list of process resources running on a remote computer on the network, but you can specify the local computer by passing ".".

  Creates a new component for each process resource on the specified computer.

  An array of type that represents all the process resources running on the specified computer.

  The computer from which to read the list of processes.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process[] ``

  Use this method to create an array of new components and associate them with all the process resources that are running the same executable file on the local computer. The process resources must already exist on the computer, because does not create system resources but rather associates them with application-generated components. A can be specified for an executable file that is not currently running on the local computer, so the array the method returns can be empty.

  The process name is a friendly name for the process, such as Outlook, that does not include the .exe extension or the path. is helpful for getting and manipulating all the processes that are associated with the same executable file. For example, you can pass an executable file name as the parameter, in order to shut down all the running instances of that executable file.

  Although a process is unique to a single process resource on the system, multiple processes on the local computer can be running the application specified by the parameter. Therefore, returns one process at most, but returns an array containing all the associated processes. If you need to manipulate the process using standard API calls, you can query each of these processes in turn for its identifier. You cannot access process resources through the process name alone but, once you have retrieved an array of components that have been associated with the process resources, you can start, terminate, and otherwise manipulate the system resources.

  Creates an array of new components and associates them with all the process resources on the local computer that share the specified process name.

  An array of type that represents the process resources running the specified application or file.

  The friendly name of the process.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Diagnostics.Process[] `` ``

  Use this method to create an array of new components and associate them with all the process resources that are running the same executable file on the specified computer. The process resources must already exist on the computer, because does not create system resources but rather associates them with application-generated components. A can be specified for an executable file that is not currently running on the local computer, so the array the method returns can be empty.

  The process name is a friendly name for the process, such as Outlook, that does not include the .exe extension or the path. is helpful for getting and manipulating all the processes that are associated with the same executable file. For example, you can pass an executable file name as the parameter, in order to shut down all the running instances of that executable file.

  Although a process is unique to a single process resource on the system, multiple processes on the local computer can be running the application specified by the parameter. Therefore, returns one process at most, but returns an array containing all the associated processes. If you need to manipulate the process using standard API calls, you can query each of these processes in turn for its identifier. You cannot access process resources through the process name alone but, once you have retrieved an array of components that have been associated with the process resources, you can start, terminate, and otherwise manipulate the system resources.

  You can use this overload to get processes on the local computer as well as on a remote computer. Use "." to specify the local computer. Another overload exists that uses the local computer by default.

  You can access processes on remote computers only to view information, such as statistics, about the processes. You cannot close, terminate (using ), or start processes on remote computers.

  Creates an array of new components and associates them with all the process resources on a remote computer that share the specified process name.

  An array of type that represents the process resources running the specified application or file.

  The friendly name of the process. The name of a computer on the network.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Handle for this process.")
  System.IntPtr To be added: an object of type 'IntPtr'

  An application can obtain a handle to a process that can be used as a parameter to many process-information and control functions. You can use this handle to initialize a or to call native methods with platform invoke.

  This process handle is private to an application--in other words, process handles cannot be shared. A process also has a process which, unlike the , is unique and, therefore, valid throughout the system.

  Only processes started through a call to set the property of the corresponding instances.

  Gets the native handle of the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Handles for this process.")
  System.MonoTODO
  System.Int32 To be added: an object of type 'int'

  Handles provide a way for a process to refer to objects. A process can obtain handles to files, resources, message queues, and many other operating system objects. The operating system reclaims the memory associated with the process only when the handle count is zero.

  Gets the number of handles opened by the process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Determines if the process is still running.")
  System.Boolean To be added: an object of type 'bool'

  A value of true for indicates that the associated process has terminated, either normally or abnormally. You can request or force the associated process to exit by calling or . If a handle is open to the process, the operating system releases the process memory when the process has exited, but retains administrative information about the process, such as the handle, exit code, and exit time. To get this information, you can use the and properties. These properties are populated automatically for processes that were started by this component. The administrative information is released when all the components that are associated with the system process are destroyed and hold no more handles to the exited process.

  A process can terminate independently of your code. If you started the process using this component, the system updates the value of automatically, even if the associated process exits independently.

  When standard output has been redirected to asynchronous event handlers, it is possible that output processing will not have completed when this property returns true. To ensure that asynchronous event handling has been completed, call the overload that takes no parameter before checking .

  Gets a value indicating whether the associated process has been terminated.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Process identifier.")
  System.Int32 To be added: an object of type 'int'

  The process is not valid if the associated process is not running. Therefore, you should ensure that the process is running before attempting to retrieve the property. Until the process terminates, the process identifier uniquely identifies the process throughout the system.

  You can connect a process that is running on a local or remote computer to a new instance by passing the process identifier to the method. is a static method that creates a new component and sets the property for the new instance automatically.

  Process identifiers can be reused by the system. The property value is unique only while the associated process is running. After the process has terminated, the system can reuse the property value for an unrelated process.

  Because the identifier is unique on the system, you can pass it to other threads as an alternative to passing a instance. This action can save system resources yet guarantee that the process is correctly identified.

  Gets the unique identifier for the associated process.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  forces a termination of the process, while only requests a termination. When a process with a graphical interface is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately.

  The method executes asynchronously. After calling the method, call the method to wait for the process to exit, or check the property to determine if the process has exited.

  Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces.

  You can call and only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers.

  If the call to the method is made while the process is currently terminating, a is thrown for Access Denied.

  Immediately stops the associated process.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Void

  Some operating system processes run in a special mode. Attempting to read properties of or attach to these processes is not possible unless you have called on the component. Call when you no longer need access to these processes that run in special mode.

  Takes a component out of the state that lets it interact with operating system processes that run in a special mode.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The name of the computer running the process.")
  System.MonoTODO
  System.String To be added: an object of type 'string'

  You can view statistical data and process information for processes running on remote computers but you cannot call , , or on remote computers.

  When the associated process is executing on the local machine, this property returns a period (".") for the machine name. You should use the property to get the correct machine name.

  Gets the name of the computer the associated process is running on.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The main module of the process.")
  System.Diagnostics.ProcessModule To be added: an object of type 'ProcessModule'

  A process module represents a.dll or .exe file that is loaded into a particular process. The property lets you view information about the executable used to start the process, including the module name, file name, and module memory details.

  Gets the main module for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The handle of the main window of the process.")
  System.MonoTODO
  System.IntPtr To be added: an object of type 'IntPtr'

  The main window is the window opened by the process that currently has the focus (the form). You must use the method to refresh the object to get the current main window handle if it has changed.

  You can get the property only for processes that are running on the local computer. The property is a value that uniquely identifies the window that is associated with the process.

  A process has a main window associated with it only if the process has a graphical interface. If the associated process does not have a main window, the value is zero. The value is also zero for processes that have been hidden, that is, processes that are not visible in the taskbar. This can be the case for processes that appear as icons in the notification area, at the far right of the taskbar.

  If you have just started a process and want to use its main window handle, consider using the method to allow the process to finish starting, ensuring that the main window handle has been created. Otherwise, an exception will be thrown.

  Gets the window handle of the main window of the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The title of the main window of the process.")
  System.MonoTODO
  System.String To be added: an object of type 'string'

  A process has a main window associated with it only if the process has a graphical interface. If the associated process does not have a main window (so that is zero), is an empty string (""). If you have just started a process and want to use its main window title, consider using the method to allow the process to finish starting, ensuring that the main window handle has been created. Otherwise, the system throws an exception.

  The main window is the window that currently has the focus; note that this might not be the primary window for the process. You must use the method to refresh the object to get the current main window handle if it has changed.

  Gets the caption of the main window of the process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum working set for this process.")
  System.IntPtr To be added: an object of type 'IntPtr'

  The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that your application executes, including the pages in your .dll files and the system.dll files. As the working set size increases, memory demand increases.

  A process has minimum and maximum working set sizes. Each time a process resource is created, the system reserves an amount of memory equal to the minimum working set size for the process. The virtual memory manager attempts to keep at least the minimum amount of memory resident when the process is active, but it never keeps more than the maximum size.

  The system sets the default working set sizes. You can modify these sizes using the and members. However, setting these values does not guarantee that the memory will be reserved or resident.

  When you increase the working set size of a process, you take physical memory away from the rest of the system. Ensure that you do not request a minimum or maximum working set size that is too large, because doing so can degrade system performance.

  Gets or sets the maximum allowable working set size for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The minimum working set for this process.")
  System.IntPtr To be added: an object of type 'IntPtr'

  The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that your application executes, including the pages in your .dll files and the system.dll files. As the working set size increases, memory demand increases.

  A process has minimum and maximum working set sizes. Each time a process resource is created, the system reserves an amount of memory equal to the minimum working set size for the process. The virtual memory manager attempts to keep at least the minimum amount of memory resident when the process is active, but it never keeps more than the maximum size.

  The system sets the default working set sizes. You can modify these sizes using the and members. However, setting these values does not guarantee that the memory will be reserved or resident.

  When you increase the working set size of a process, you take physical memory away from the rest of the system. Ensure that you do not request a minimum or maximum working set size that is too large, because doing so can degrade system performance.

  Gets or sets the minimum allowable working set size for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The modules that are loaded as part of this process.")
  System.Diagnostics.ProcessModuleCollection To be added: an object of type 'ProcessModuleCollection'

  A process module represents a.dll or .exe file that is loaded into a particular process. A instance lets you view information about a module, including the module name, file name, and module memory details.

  A process can load multiple modules into memory. For example,.exe files that load additional .dll files have multiple modules.

  After starting the process, this collection is empty until the system has loaded the process. If the process has a main window, you can call before retrieving this property to ensure that the collection is nonempty when you get the list.

  Gets the modules that have been loaded by the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The number of bytes that are not pageable.")
  System.MonoTODO
  System.Obsolete("Use NonpagedSystemMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the nonpaged system memory size allocated to this process.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The number of bytes that are not pageable.")
  System.MonoTODO
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the current size of nonpaged system memory used by the process. System memory is the physical memory used by the operating system, and is divided into paged and nonpaged pools. Nonpaged memory allocations remain in system memory and are not paged out to the virtual memory paging file.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Pool Nonpaged Bytes performance counter for the process.

  Gets the amount of nonpaged system memory allocated for the associated process.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  is the API method that raises the event. Calling causes the event to occur and is the only way to raise the event using the component. is primarily used when deriving classes from the component.

  As an alternative to , you can write your own event handler. You create your own event handler delegate and your own event-handling method.

  If you are using the Visual Studio environment, an event handler delegate (AddOnExited) and an event-handling method (Process1_Exited) are created for you when you drag a component onto a form and double-click the icon. The code you create to run when the event occurs is entered into the Process1_Exited procedure. You do not need to create the member, because it is implemented for you.

  Raising an event invokes the event handler through a delegate. For an overview, see [<topic://cpconProvidingEventFunctionality>].

  Raises the event.

- Event
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(true)
  System.Diagnostics.MonitoringDescription("Raised when it receives output data")
  System.Diagnostics.DataReceivedEventHandler

  The event indicates that the associated has written to its redirected stream.

  The event is enabled during asynchronous read operations on . To start asynchronous read operations, you must redirect the stream of a , add your event handler to the event, and call . Thereafter, the event signals each time the process writes a line to the redirected stream, until the process exits or calls .

  The application that is processing the asynchronous output should call the method to ensure that the output buffer has been flushed.

  Occurs when an application writes to its redirected stream.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The number of bytes that are paged.")
  System.MonoTODO
  System.Obsolete("Use PagedMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the paged memory size.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The number of bytes that are paged.")
  System.MonoTODO
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the current size of memory in the virtual memory paging file used by the process. The operating system uses the virtual memory paging file in conjunction with physical memory to manage the virtual address space for each process. When pageable memory is not in use, it can be transferred to the virtual memory paging file on disk. To obtain the size of memory used by the operating system for the process, use the property.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Page File Bytes performance counter for the process.

  Gets the amount of paged memory allocated for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of paged system memory in bytes.")
  System.MonoTODO
  System.Obsolete("Use PagedSystemMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the paged system memory size.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of paged system memory in bytes.")
  System.MonoTODO
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property value represents the current size of pageable system memory used by the process. System memory is the physical memory used by the operating system, and is divided into paged and nonpaged pools. When pageable memory is not in use, it can be transferred to the virtual memory paging file on disk. To obtain the size of the application memory used by the process, use the property.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Pool Paged Bytes performance counter for the process.

  Gets the amount of pageable system memory allocated for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of paged memory used by this process.")
  System.MonoTODO
  System.Obsolete("Use PeakPagedMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the peak paged memory size.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of paged memory used by this process.")
  System.MonoTODO
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property value represents the maximum size of memory in the virtual memory paging file used by the process since it started. The operating system uses the virtual memory paging file in conjunction with physical memory to manage the virtual address space for each process. When pageable memory is not in use, it can be transferred to the virtual memory paging file on disk.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Page File Bytes Peak performance counter for the process.

  Gets the maximum amount of memory in the virtual memory paging file used by the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of virtual memory used by this process.")
  System.Obsolete("Use PeakVirtualMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the peak virtual memory size.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of virtual memory used by this process.")
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the maximum size of virtual memory used by the process since it started. The operating system maps the virtual address space for each process either to pages loaded in physical memory, or to pages stored in the virtual memory paging file on disk.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Virtual Bytes Peak performance counter for the process.

  Gets the maximum amount of virtual memory used by the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of system memory used by this process.")
  System.Obsolete("Use PeakWorkingSet64")
  System.Int32 To be added: an object of type 'int'

  The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that the process executes, including process modules and the system libraries.

  Gets the peak working set size for the associated process.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The maximum amount of system memory used by this process.")
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the maximum size of working set memory used by the process since it started. The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that the process executes, including instructions from the process modules and the system libraries.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Working Set Peak performance counter for the process.

  Gets the maximum amount of physical memory used by the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Process will be of higher priority while it is actively used.")
  System.MonoTODO
  System.Boolean To be added: an object of type 'bool'

  When a thread runs in a process for which the priority class has one of the dynamic priority enumeration values (, , or ), the system temporarily boosts the thread's priority when it is taken out of a wait state. This action prevents other processes from interrupting the processing of the current thread. The setting affects all the existing threads and any threads subsequently created by the process. To restore normal behavior, set the property to false.

  Boosting the priority too high can drain resources from essential operating system and network functions, causing problems with other operating system tasks.

  Gets or sets a value indicating whether the associated process priority should temporarily be boosted by the operating system when the main window has the focus.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The relative process priority.")
  System.MonoLimitation("Under Unix, only root is allowed to raise the priority.")
  System.Diagnostics.ProcessPriorityClass To be added: an object of type 'ProcessPriorityClass'

  A process priority class encompasses a range of thread priority levels. Threads with different priorities that are running in the process run relative to the priority class of the process. Win32 uses four priority classes with seven base priority levels per class. These process priority classes are captured in the enumeration, which lets you set the process priority to , , , , , or . Based on the time elapsed or other boosts, the base priority level can be changed by the operating system when a process needs to be put ahead of others for access to the processor. In addition, you can set the to temporarily boost the priority level of threads that have been taken out of the wait state. The priority is reset when the process returns to the wait state.

  The property lets you view the starting priority that is assigned to a process. However, because it is read-only, you cannot use the property to set the priority of a process. To change the priority, use the property, which gets or sets the overall priority category for the process.

  The priority class cannot be viewed using System Monitor. The following table shows the relationship between the and values.

  BasePriority

  PriorityClass

  4

  8

  13

  24

  Gets or sets the overall priority category for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of memory exclusively used by this process.")
  System.Obsolete("Use PrivateMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the private memory size.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of memory exclusively used by this process.")
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the current size of memory used by the process that cannot be shared with other processes.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Private Bytes performance counter for the process.

  Gets the amount of private memory allocated for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of processing time spent in the OS core for this process.")
  System.TimeSpan To be added: an object of type 'TimeSpan' To be added

  Gets the privileged processor time for this process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The name of this process.")
  System.String To be added: an object of type 'string'

  The property holds an executable file name, such as Outlook, that does not include the .exe extension or the path. It is helpful for getting and manipulating all the processes that are associated with the same executable file.

  On win2kfamily operating systems, the property may be truncated to 15 characters if the process module information cannot be obtained.

  You can call , passing it an executable file name, to retrieve an array that contains every running instance on the specified computer. You can use this array, for example, to shut down all the running instances of the executable file.

  Gets the name of the process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Allowed processor that can be used by this process.")
  System.MonoTODO
  System.IntPtr To be added: an object of type 'IntPtr'

  In Windows 2000 and later, a thread in a process can migrate from processor to processor, with each migration reloading the processor cache. Under heavy system loads, specifying which processor should run a specific thread can improve performance by reducing the number of times the processor cache is reloaded. The association between a processor and a thread is called the processor affinity.

  Each processor is represented as a bit. Bit 0 is processor one, bit 1 is processor two, and so forth. If you set a bit to the value 1, the corresponding processor is selected for thread assignment. When you set the value to zero, the operating system's scheduling algorithms set the thread's affinity. When the value is set to any nonzero value, the value is interpreted as a bitmask that specifies those processors eligible for selection.

  The following table shows a selection of values for an eight-processor system.

  Bitmask

  Binary value

  Eligible processors

  0x0001

  00000000 00000001

  1

  0x0003

  00000000 00000011

  1 and 2

  0x0007

  00000000 00000111

  1, 2 and 3

  0x0009

  00000000 00001001

  1 and 4

  0x007F

  00000000 01111111

  1, 2, 3, 4, 5, 6 and 7

  Gets or sets the processors on which the threads in this process can be scheduled to run.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  After is called, the first request for information about each property causes the process component to obtain a new value from the associated process.

  When a component is associated with a process resource, the property values of the are immediately populated according to the status of the associated process. If the information about the associated process subsequently changes, those changes are not reflected in the component's cached values. The component is a snapshot of the process resource at the time they are associated. To view the current values for the associated process, call the method.

  Discards any information about the associated process that has been cached inside the process component.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("Is this process responsive.")
  System.MonoTODO
  System.Boolean To be added: an object of type 'bool'

  If a process has a user interface, the property contacts the user interface to determine whether the process is responding to user input. If the interface does not respond immediately, the property returns false. Use this property to determine whether the interface of the associated process has stopped responding.

  If the process does not have a , this property returns true.

  Gets a value indicating whether the user interface of the process is responding.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The session ID for this process.")
  System.MonoNotSupported("")
  System.Int32 To be added.

  The property identifies the session in which the application is currently running.

  Gets the Terminal Services session identifier for the associated process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The standard error stream of this process.")
  System.IO.StreamReader To be added: an object of type 'IO.StreamReader'

  When a writes text to its standard error stream, that text is normally displayed on the console. By redirecting the stream, you can manipulate or suppress the error output of a process. For example, you can filter the text, format it differently, or write the output to both the console and a designated log file.

  To use , you must set to false, and you must set to true. Otherwise, reading from the stream throws an exception.

  The redirected stream can be read synchronously or asynchronously. Methods such as , , and perform synchronous read operations on the error output stream of the process. These synchronous read operations do not complete until the associated writes to its stream, or closes the stream.

  In contrast, starts asynchronous read operations on the stream. This method enables a designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.

  Synchronous read operations introduce a dependency between the caller reading from the stream and the child process writing to that stream. These dependencies can result in deadlock conditions. When the caller reads from the redirected stream of a child process, it is dependent on the child. The caller waits on the read operation until the child writes to the stream or closes the stream. When the child process writes enough data to fill its redirected stream, it is dependent on the parent. The child process waits on the next write operation until the parent reads from the full stream or closes the stream. The deadlock condition results when the caller and child process wait on each other to complete an operation, and neither can proceed. You can avoid deadlocks by evaluating dependencies between the caller and child process.

  The following C# code, for example, shows how to read from a redirected stream and wait for the child process to exit.

  `// Start the child process. Process p = new Process(); // Redirect the error stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardError = true; p.StartInfo.FileName = "Write500Lines.exe"; p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected error stream. // p.WaitForExit(); // Read the error stream first and then wait. string error = p.StandardError.ReadToEnd(); p.WaitForExit();`

  The code example avoids a deadlock condition by calling p.StandardError.ReadToEnd before p.WaitForExit. A deadlock condition can result if the parent process calls p.WaitForExit before p.StandardError.ReadToEnd and the child process writes enough text to fill the redirected stream. The parent process would wait indefinitely for the child process to exit. The child process would wait indefinitely for the parent to read from the full stream.

  There is a similar issue when you read all text from both the standard output and standard error streams. The following C# code, for example, performs a read operation on both streams.

  `// Do not perform a synchronous read to the end of both // redirected streams. // string output = p.StandardOutput.ReadToEnd(); // string error = p.StandardError.ReadToEnd(); // p.WaitForExit(); // Use asynchronous read operations on at least one of the streams. p.BeginOutputReadLine(); string error = p.StandardError.ReadToEnd(); p.WaitForExit();`

  The code example avoids the deadlock condition by performing asynchronous read operations on the stream. A deadlock condition results if the parent process calls p.StandardOutput.ReadToEnd followed by p.StandardError.ReadToEnd and the child process writes enough text to fill its error stream. The parent process would wait indefinitely for the child process to close its stream. The child process would wait indefinitely for the parent to read from the full stream.

  You can use asynchronous read operations to avoid these dependencies and their deadlock potential. Alternately, you can avoid the deadlock condition by creating two threads and reading the output of each stream on a separate thread.

  You cannot mix asynchronous and synchronous read operations on a redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. For example, do not follow with a call to on the stream, or vice versa. However, you can read two different streams in different modes. For example, you can call and then call for the stream.

  Gets a stream used to read the error output of the application.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The standard input stream of this process.")
  System.IO.StreamWriter To be added: an object of type 'IO.StreamWriter'

  A can read input text from its standard input stream, typically the keyboard. By redirecting the stream, you can programmatically specify the input. For example, instead of using keyboard input, you can provide text from the contents of a designated file or output from another application.

  To use , you must set to false, and you must set to true. Otherwise, writing to the stream throws an exception.

  Gets a stream used to write the input of the application.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The standard output stream of this process.")
  System.IO.StreamReader To be added: an object of type 'IO.StreamReader'

  When a writes text to its standard stream, that text is normally displayed on the console. By redirecting the stream, you can manipulate or suppress the output of a process. For example, you can filter the text, format it differently, or write the output to both the console and a designated log file.

  To use , you must set to false, and you must set to true. Otherwise, reading from the stream throws an exception.

  The redirected stream can be read synchronously or asynchronously. Methods such as , , and perform synchronous read operations on the output stream of the process. These synchronous read operations do not complete until the associated writes to its stream, or closes the stream.

  In contrast, starts asynchronous read operations on the stream. This method enables a designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.

  Synchronous read operations introduce a dependency between the caller reading from the stream and the child process writing to that stream. These dependencies can result in deadlock conditions. When the caller reads from the redirected stream of a child process, it is dependent on the child. The caller waits on the read operation until the child writes to the stream or closes the stream. When the child process writes enough data to fill its redirected stream, it is dependent on the parent. The child process waits on the next write operation until the parent reads from the full stream or closes the stream. The deadlock condition results when the caller and child process wait on each other to complete an operation, and neither can proceed. You can avoid deadlocks by evaluating dependencies between the caller and child process.

  The following C# code, for example, shows how to read from a redirected stream and wait for the child process to exit.

  `// Start the child process. Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "Write500Lines.exe"; p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected stream. // p.WaitForExit(); // Read the output stream first and then wait. string output = p.StandardOutput.ReadToEnd(); p.WaitForExit();`

  The code example avoids a deadlock condition by calling p.StandardOutput.ReadToEnd before p.WaitForExit. A deadlock condition can result if the parent process calls p.WaitForExit before p.StandardOutput.ReadToEnd and the child process writes enough text to fill the redirected stream. The parent process would wait indefinitely for the child process to exit. The child process would wait indefinitely for the parent to read from the full stream.

  There is a similar issue when you read all text from both the standard output and standard error streams. The following C# code, for example, performs a read operation on both streams.

  `// Do not perform a synchronous read to the end of both // redirected streams. // string output = p.StandardOutput.ReadToEnd(); // string error = p.StandardError.ReadToEnd(); // p.WaitForExit(); // Use asynchronous read operations on at least one of the streams. p.BeginOutputReadLine(); string error = p.StandardError.ReadToEnd(); p.WaitForExit();`

  The code example avoids the deadlock condition by performing asynchronous read operations on the stream. A deadlock condition results if the parent process calls p.StandardOutput.ReadToEnd followed by p.StandardError.ReadToEnd and the child process writes enough text to fill its error stream. The parent process would wait indefinitely for the child process to close its stream. The child process would wait indefinitely for the parent to read from the full stream.

  You can use asynchronous read operations to avoid these dependencies and their deadlock potential. Alternately, you can avoid the deadlock condition by creating two threads and reading the output of each stream on a separate thread.

  You cannot mix asynchronous and synchronous read operations on a redirected stream. Once the redirected stream of a is opened in either asynchronous or synchronous mode, all further read operations on that stream must be in the same mode. For example, do not follow with a call to on the stream, or vice versa. However, you can read two different streams in different modes. For example, you can call and then call for the stream.

  Gets a stream used to read the output of the application.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  Use this overload to start a process resource and associate it with the current component. The return value true indicates that a new process resource was started. If the process resource specified by the member of the property is already running on the computer, no additional process resource is started. Instead, the running process resource is reused and false is returned.

  You can start a ClickOnce application by specifying the location (for example, a Web address) from which you originally installed the application. Do not start a ClickOnce application by specifying its installed location on your hard drive.

  If you are using Visual Studio, this overload of the method is the one that you insert into your code after you drag a component onto the designer. Use the Properties window to expand the StartInfo category and write the appropriate value into the FileName property. Your changes will appear in the form's InitializeComponent procedure.

  This overload of is not a static method. You must call it from an instance of the class. Before calling , you must first specify property information for this instance, because that information is used to determine the process resource to start.

  The other overloads of the method are static members. You do not need to create an instance of the component before you call those overloads of the method. Instead, you can call for the class itself, and a new component is created if the process was started. Or, null is returned if a process was reused. The process resource is automatically associated with the new component that is returned by the method.

  The members can be used to duplicate the functionality of the Run dialog box of the Windows Start menu. Anything that can be typed into a command line can be started by setting the appropriate values in the property. The only property that must be set is the property. The property does not have to be an executable file. It can be of any file type for which the extension has been associated with an application that is installed on the system. For example, the property can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc extension if you have associated.doc files with a word processing tool, such as Microsoft Word.

  In the command line, you can specify actions to take for certain types of files. For example, you can print documents or edit text files. Specify these actions using the member of the property. For other types of files, you can specify command-line arguments when you start the file from the Run dialog box. For example, you can pass a URL as an argument if you specify your browser as the . These arguments can be specified in the property's member.

  If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

  ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop.

  Whenever you use to start a process, you might need to close it or you risk losing system resources. Close processes using or .

  A note about apartment states in managed threads is necessary here. When is true on the process component's property, make sure you have set a threading model on your application by setting the attribute [STAThread] on the main() method. Otherwise, a managed thread can be in an unknown state or put in the MTA state, the latter of which conflicts with being true. Some methods require that the apartment state not be unknown. If the state is not explicitly set, when the application encounters such a method, it defaults to MTA, and once set, the apartment state cannot be changed. However, MTA causes an exception to be thrown when the operating system shell is managing the thread.

  Starts (or reuses) the process resource that is specified by the property of this component and associates it with the component.

  true if a process resource is started; false if no new process resource is started (for example, if an existing process is reused).

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process ``

  Use this overload to start a process resource by specifying a instance. The overload associates the resource with a new component. If the process is already running, no additional process resource is started. Instead, the existing process resource is reused and no new component is created. In such a case, instead of returning a new component, returns null to the calling procedure.

  If the address of the executable file to start is a URL, the process is not started and null is returned.

  This overload lets you start a process without first creating a new instance. Using this overload with a parameter is an alternative to the explicit steps of creating a new instance, setting its properties, and calling for the instance.

  Using a instance as the parameter lets you call with the most control over what is passed into the call to start the process. If you need to pass only a file name or a file name and arguments, it is not necessary to create a new instance, although that is an option. The only property that must be set is the property. The property does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application that is installed on the system. For example, the property can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc extension if you have associated.doc files with a word processing tool, such as Microsoft Word.

  You can start a ClickOnce application by specifying the location (for example, a Web address) from which you originally installed the application. Do not start a ClickOnce application by specifying its installed location on your hard drive.

  If the and properties of the instance are set, the unmanaged CreateProcessWithLogonW function is called, which starts the process in a new window even if the property value is true or the property value is .

  Unlike the other overloads, the overload of that has no parameters is not a static member. Use that overload when you have already created a instance, specified start information (including the file name), and want to start a process resource and associate it with the existing instance. Use one of the static overloads when you want to create a new component rather than start a process for an existing component. Both this overload and the overload that has no parameters allow you to specify the start information for the process resource by using a instance.

  If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

  ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop.

  Whenever you use to start a process, you might need to close it or you risk losing system resources. Close processes using or .

  A note about apartment states in managed threads is necessary here. When is true on the parameter, make sure you have set a threading model on your application by setting the attribute [STAThread] on the main() method. Otherwise, a managed thread can be in an unknown state or put in the MTA state, the latter of which conflicts with being true. Some methods require that the apartment state not be unknown. If the state is not explicitly set, when the application encounters such a method, it defaults to MTA, and once set, the apartment state cannot be changed. However, MTA causes an exception to be thrown when the operating system shell is managing the thread.

  Starts the process resource that is specified by the parameter containing process start information (for example, the file name of the process to start) and associates the resource with a new component.

  A new component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused).

  The that contains the information that is used to start the process, including the file name and any command-line arguments.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process ``

  Use this overload to start a process resource by specifying its file name. The overload associates the resource with a new component. If the process is already running, no additional process resource is started. Instead, the existing process resource is reused and no new component is created. In such a case, instead of returning a new component, returns null to the calling procedure.

  If the address of the executable file to start is a URL, the process is not started and null is returned.

  This overload lets you start a process without first creating a new instance. The overload is an alternative to the explicit steps of creating a new instance, setting the member of the property, and calling for the instance.

  You can start a ClickOnce application by setting the parameter to the location (for example, a Web address) from which you originally installed the application. Do not start a ClickOnce application by specifying its installed location on your hard drive.

  Starting a process by specifying its file name is similar to typing the information in the Run dialog box of the Windows Start menu. Therefore, the file name does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system. For example the file name can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc if you have associated.doc files with a word processing tool, such as Microsoft Word. Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the parameter. For example, you can set the parameter to either "Notepad.exe" or "Notepad".

  This overload does not allow command-line arguments for the process. If you need to specify one or more command-line arguments for the process, use the or overloads.

  Unlike the other overloads, the overload of that has no parameters is not a static member. Use that overload when you have already created a instance, specified start information (including the file name), and want to start a process resource and associate it with the existing instance. Use one of the static overloads when you want to create a new component rather than start a process for an existing component. Both this overload and the overload that has no parameters allow you to specify the file name of the process resource to start.

  If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

  ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop.

  Whenever you use to start a process, you might need to close it or you risk losing system resources. Close processes using or .

  A note about apartment states in managed threads is necessary here. When is true on the process component's property, make sure you have set a threading model on your application by setting the attribute [STAThread] on the main() method. Otherwise, a managed thread can be in an unknown state or put in the MTA state, the latter of which conflicts with being true. Some methods require that the apartment state not be unknown. If the state is not explicitly set, when the application encounters such a method, it defaults to MTA, and once set, the apartment state cannot be changed. However, MTA causes an exception to be thrown when the operating system shell is managing the thread.

  Starts a process resource by specifying the name of a document or application file and associates the resource with a new component.

  A new component that is associated with the process resource, or null, if no process resource is started (for example, if an existing process is reused).

  The name of a document or application file to run in the process.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process `` ``

  Use this overload to start a process resource by specifying its file name and command-line arguments. The overload associates the resource with a new component. If the process is already running, no additional process is started. Instead, the existing process resource is reused and no new component is created. In such a case, instead of returning a new component, returns null to the calling procedure.

  If the address of the executable file to start is a URL, the process is not started and null is returned.

  This overload lets you start a process without first creating a new instance. The overload is an alternative to the explicit steps of creating a new instance, setting the and members of the property, and calling for the instance.

  Starting a process by specifying its file name and arguments is similar to typing the file name and command-line arguments in the Run dialog box of the Windows Start menu. Therefore, the file name does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system. For example the file name can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc if you have associated.doc files with a word processing tool, such as Microsoft Word. Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the parameter. For example, you can set the parameter to either "Notepad.exe" or "Notepad". If the parameter represents an executable file, the parameter might represent a file to act upon, such as the text file in Notepad.exe myfile.txt. If the parameter represents a command (.cmd) file, the parameter must include either a "/c" or "/k" argument to specify whether the command window exits or remains after completion.

  Unlike the other overloads, the overload of that has no parameters is not a static member. Use that overload when you have already created a instance, specified start information (including the file name), and want to start a process resource and associate it with the existing instance. Use one of the static overloads when you want to create a new component rather than start a process for an existing component. Both this overload and the overload that has no parameters allow you to specify the file name of the process resource to start and command-line arguments to pass.

  If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

  ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop.

  Whenever you use to start a process, you might need to close it or you risk losing system resources. Close processes using or .

  A note about apartment states in managed threads is necessary here. When is true on the process component's property, make sure you have set a threading model on your application by setting the attribute [STAThread] on the main() method. Otherwise, a managed thread can be in an unknown state or put in the MTA state, the latter of which conflicts with being true. Some methods require that the apartment state not be unknown. If the state is not explicitly set, when the application encounters such a method, it defaults to MTA, and once set, the apartment state cannot be changed. However, MTA causes an exception to be thrown when the operating system shell is managing the thread.

  Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new component.

  A new component that is associated with the process, or null, if no process resource is started (for example, if an existing process is reused).

  The name of an application file to run in the process. Command-line arguments to pass when starting the process.
- Method
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process `` `` `` `` To be added.

  Use this overload to create a new process and its primary thread by specifying its file name, user name, password, and domain. The new process then runs the specified executable file in the security context of the specified credentials (user, domain, and password).

  When the executable file is located on a remote drive, you must identify the network share by using a uniform resource identifier (URI), not a linked drive letter.

  If the address of the executable file to start is a URL, the process is not started and null is returned.

  If the process is already running, no additional process resource is started. Instead, the existing process resource is reused and no new component is created. In such a case, instead of returning a new component, returns null to the calling procedure.

  This overload lets you start a process without first creating a new instance. The overload is an alternative to the explicit steps of creating a new instance, setting the , , , and properties of the property, and calling for the instance.

  Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the parameter. For example, you can set the parameter to either "Notepad.exe" or "Notepad". If the parameter represents an executable file, the parameter might represent a file to act upon, such as the text file in Notepad.exe myfile.txt.

  The file name must represent an executable file in the overloads that have , , and parameters.

  Starts a process resource by specifying the name of an application, a user name, a password, and a domain and associates the resource with a new component.

  A new component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused).

  The name of an application file to run in the process. A that contains the password to use when starting the process. The domain to use when starting the process.
- Method
  2.0.0.0
  4.0.0.0
  System.Diagnostics.Process `` `` `` `` `` To be added.

  Use this overload to create a new process and its primary thread by specifying its file name, command-line arguments, user name, password, and domain. The new process then runs the specified executable file in the security context of the specified credentials (user, domain, and password).

  When the executable file is located on a remote drive, you must identify the network share by using a uniform resource identifier (URI), not a linked drive letter.

  If the address of the executable file to start is a URL, the process is not started and null is returned.

  The overload associates the resource with a new component. If the process is already running, no additional process resource is started. Instead, the existing process resource is reused and no new component is created. In such a case, instead of returning a new component, returns null to the calling procedure.

  This overload lets you start a process without first creating a new instance. The overload is an alternative to the explicit steps of creating a new instance, setting the , , , , and properties of the property, and calling for the instance.

  Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the parameter. For example, you can set the parameter to either "Notepad.exe" or "Notepad". If the parameter represents an executable file, the parameter might represent a file to act upon, such as the text file in Notepad.exe myfile.txt.

  The file name must represent an executable file in the overloads that have , , and parameters.

  Starts a process resource by specifying the name of an application, a set of command-line arguments, a user name, a password, and a domain and associates the resource with a new component.

  A new component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused).

  The name of an application file to run in the process. Command-line arguments to pass when starting the process. A that contains the password to use when starting the process. The domain to use when starting the process.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.Diagnostics.MonitoringDescription("Information for the start of this process.")
  System.Diagnostics.ProcessStartInfo To be added: an object of type 'ProcessStartInfo'

  represents the set of parameters to use to start a process. When is called, the is used to specify the process to start. The only necessary member to set is the property. Starting a process by specifying the property is similar to typing the information in the Run dialog box of the Windows Start menu. Therefore, the property does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system. For example the can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc if you have associated.doc files with a word processing tool, such as Microsoft Word. Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the member. For example, you can set the property to either "Notepad.exe" or "Notepad".

  You can start a ClickOnce application by setting the property to the location (for example, a Web address) from which you originally installed the application. Do not start a ClickOnce application by specifying its installed location on your hard drive.

  If the file name involves a nonexecutable file, such as a .doc file, you can include a verb specifying what action to take on the file. For example, you could set the to "Print" for a file ending in the .doc extension. The file name specified in the property does not need to have an extension if you manually enter a value for the property. However, if you use the property to determine what verbs are available, you must include the extension.

  You can change the parameters specified in the property up to the time that you call the method on the process. After you start the process, changing the values does not affect or restart the associated process. If you call the method with the and properties set, the unmanaged CreateProcessWithLogonW function is called, which starts the process in a new window even if the property value is true or the property value is .

  If you did not use the method to start a process, the property does not reflect the parameters used to start the process. For example, if you use to get an array of processes running on the computer, the property of each does not contain the original file name or arguments used to start the process.

  When the process is started, the file name is the file that populates the (read-only) property. If you want to retrieve the executable file that is associated with the process after the process has started, use the property. If you want to set the executable file of a instance for which an associated process has not been started, use the property's member. Because the members of the property are arguments that are passed to the method of a process, changing the property after the associated process has started will not reset the property. These properties are used only to initialize the associated process.

  Gets or sets the properties to pass to the method of the .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The time this process started.")
  System.DateTime To be added: an object of type 'DateTime' To be added

  Gets the time that the associated process was started.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DefaultValue(null)
  System.Diagnostics.MonitoringDescription("The object that is used to synchronize event handler calls for this process.")
  System.ComponentModel.ISynchronizeInvoke To be added: an object of type 'ComponentModel.ISynchronizeInvoke'

  When is null, methods that handle the event are called on a thread from the system thread pool. For more information about system thread pools, see .

  When the event is handled by a visual Windows Forms component, such as a , accessing the component through the system thread pool might not work, or might result in an exception. Avoid this by setting to a Windows Forms component, which causes the methods handling the event to be called on the same thread on which the component was created.

  If the is used inside vsprvslong in a Windows Forms designer, is automatically set to the control that contains the . For example, if you place a on a designer for Form1 (which inherits from ) the property of is set to the instance of Form1:

  code reference: Process_SynchronizingObject#2

  Typically, this property is set when the component is placed inside a control or form, because those components are bound to a specific thread.

  Gets or sets the object used to marshal the event handler calls that are issued as a result of a process exit event.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The number of threads of this process.")
  System.MonoTODO
  System.Diagnostics.ProcessThreadCollection To be added: an object of type 'ProcessThreadCollection'

  A thread executes code in a process. Each process is started with a single thread, its primary thread. Any thread can create additional threads. Threads within a process share the address space of the process.

  Use to get all the threads associated with the current process. The primary thread is not necessarily at index zero in the array.

  Gets the set of threads that are running in the associated process.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added

  Formats the process's name as a string, combined with the parent component type, if applicable.

  The , combined with the base component's return value.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The total CPU time spent for this process.")
  System.TimeSpan To be added: an object of type 'TimeSpan' To be added

  Gets the total processor time for this process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The CPU time spent for this process in user mode.")
  System.TimeSpan To be added: an object of type 'TimeSpan' To be added

  Gets the user processor time for this process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of virtual memory currently used for this process.")
  System.Obsolete("Use VirtualMemorySize64")
  System.Int32 To be added: an object of type 'int' To be added

  Gets the size of the process's virtual memory.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of virtual memory currently used for this process.")
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the current size of virtual memory used by the process. The operating system maps the virtual address space for each process either to pages loaded in physical memory, or to pages stored in the virtual memory paging file on disk.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Virtual Bytes performance counter for the process.

  Gets the amount of the virtual memory allocated for the associated process.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The overload is used to make the current thread wait until the associated process terminates. This method instructs the component to wait an infinite amount of time for the process and event handlers to exit. This can cause an application to stop responding. For example, if you call for a process that has a user interface, the request to the operating system to terminate the associated process might not be handled if the process is written to never enter its message loop.

  In the net_v35_long and earlier versions, the overload waited for milliseconds (approximately 24 days), not indefinitely. Also, previous versions did not wait for the event handlers to exit if the full time was reached.

  This overload ensures that all processing has been completed, including the handling of asynchronous events for redirected standard output. You should use this overload after a call to the overload when standard output has been redirected to asynchronous event handlers.

  When an associated process exits (that is, when it is shut down by the operation system through a normal or abnormal termination), the system stores administrative information about the process and returns to the component that had called . The component can then access the information, which includes the , by using the to the exited process.

  Because the associated process has exited, the property of the component no longer points to an existing process resource. Instead, the handle can be used only to access the operating system's information about the process resource. The system is aware of handles to exited processes that have not been released by components, so it keeps the and information in memory until the component specifically frees the resources. For this reason, any time you call for a instance, call when the associated process has terminated and you no longer need any administrative information about it. frees the memory allocated to the exited process.

  Instructs the component to wait indefinitely for the associated process to exit.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The overload is used to make the current thread wait until the associated process terminates. This overload instructs the component to wait a finite amount of time for the process to exit. If the associated process does not exit by the end of the interval because the request to terminate is denied, false is returned to the calling procedure. You can specify a negative number () for , and will behave the same as the overload. If you pass 0 (zero) to the method, it returns true only if the process has already exited; otherwise, it immediately returns false.

  In the net_v35_long and earlier versions, if was -1, the overload waited for milliseconds (approximately 24 days), not indefinitely.

  When standard output has been redirected to asynchronous event handlers, it is possible that output processing will not have completed when this method returns. To ensure that asynchronous event handling has been completed, call the overload that takes no parameter after receiving a true from this overload. To help ensure that the event is handled correctly in Windows Forms applications, set the property.

  When an associated process exits (is shut down by the operating system through a normal or abnormal termination), the system stores administrative information about the process and returns to the component that had called . The component can then access the information, which includes the , by using the to the exited process.

  Because the associated process has exited, the property of the component no longer points to an existing process resource. Instead, the handle can be used only to access the operating system's information about the process resource. The system is aware of handles to exited processes that have not been released by components, so it keeps the and information in memory until the component specifically frees the resources. For this reason, any time you call for a instance, call when the associated process has terminated and you no longer need any administrative information about it. frees the memory allocated to the exited process.

  Instructs the component to wait the specified number of milliseconds for the associated process to exit.

  true if the associated process has exited; otherwise, false.

  The amount of time, in milliseconds, to wait for the associated process to exit. The maximum is the largest possible value of a 32-bit integer, which represents infinity to the operating system.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean

  Use to force the processing of your application to wait until the message loop has returned to the idle state. When a process with a user interface is executing, its message loop executes every time a Windows message is sent to the process by the operating system. The process then returns to the message loop. A process is said to be in an idle state when it is waiting for messages inside of a message loop. This state is useful, for example, when your application needs to wait for a starting process to finish creating its main window before the application communicates with that window.

  If a process does not have a message loop, throws an .

  The overload instructs the component to wait indefinitely for the process to become idle in the message loop. This instruction can cause an application to stop responding. For example, if the process is written to always exit its message loop immediately, as in the code fragment while(true).

  Causes the component to wait indefinitely for the associated process to enter an idle state. This overload applies only to processes with a user interface and, therefore, a message loop.

  true if the associated process has reached an idle state.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Boolean ``

  Use to force the processing of your application to wait until the message loop has returned to the idle state. When a process with a user interface is executing, its message loop executes every time a Windows message is sent to the process by the operating system. The process then returns to the message loop. A process is said to be in an idle state when it is waiting for messages inside of a message loop. This state is useful, for example, when your application needs to wait for a starting process to finish creating its main window before the application communicates with that window.

  If a process does not have a message loop, throws an .

  The overload instructs the component to wait a finite amount of time for the process to become idle in the message loop. If the associated process has not become idle by the end of the interval because the loop is still processing messages, false is returned to the calling procedure.

  For more information about handling events, see [<topic://cpconEventsOverview>].

  Causes the component to wait the specified number of milliseconds for the associated process to enter an idle state. This overload applies only to processes with a user interface and, therefore, a message loop.

  true if the associated process has reached an idle state; otherwise, false.

  A value of 1 to that specifies the amount of time, in milliseconds, to wait for the associated process to become idle. A value of 0 specifies an immediate return, and a value of -1 specifies an infinite wait.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of physical memory currently used for this process.")
  System.Obsolete("Use WorkingSet64")
  System.Int32 To be added: an object of type 'int'

  The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that the process executes, including the process modules and the system libraries.

  Gets the associated process's physical memory usage.

- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The amount of physical memory currently used for this process.")
  System.Runtime.InteropServices.ComVisible(false)
  System.Int64 To be added.

  The value returned by this property represents the current size of working set memory used by the process. The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault.

  The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that the process executes, including instructions in the process modules and the system libraries.

  This property can be used to monitor memory usage on computers with 32-bit processors or 64-bit processors. The property value is equivalent to the Working Set performance counter for the process.

  Gets the amount of physical memory allocated for the associated process.