Use this method to create a new Process 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 GetProcessById does not create a system resource, but rather associates a resource with an application-generated Process component. A process Id can be retrieved only for a process that is currently running on the computer. After the process terminates, GetProcessById throws an exception if you pass it an expired identifier.
On any particular computer, the identifier of a process is unique. GetProcessById returns one process at most. If you want to get all the processes running a particular application, use GetProcessesByName. If multiple processes exist on the computer running the specified application, GetProcessesByName 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 machineName, the local computer is used. Alternatively, you can specify the local computer by setting machineName to the value "." or to an empty string ("").
Windows 98, Windows Millennium Edition Platform Note:
The machineName parameter is not supported on Windows 98 or Windows Millennium Edition (Windows Me).