How to: Bind to Existing Processes
You can use thecomponent as a connection between your application and the processes on your computer. You bind to an existing process by using the method to return an array of processes (in the form of Process component instances) associated with each running instance of the specified file name. The first element of the array will be the first instance of the running process that the method finds. If there is only one instance of the process, the index of 0 can be used to reference the single instance of the process. You can use each of these returned instances to manipulate the processes with which they are associated.
To bind to an existing process
Create an instance of the Process component. For more information, see.
Declare an empty array of the type Process to hold the array of Process components.
Fill the process array by calling the GetProcessesByName ormethod and use the returning value to populate the process array.
The following example shows how to call the GetProcessesByName method to add Notepad.exe to the process array.
Use the indexed property value to manipulate a single process in the array.