IsProcessRunning() public static method

Gets whether the process with the specified ID is currently running.
public static IsProcessRunning ( int processId ) : bool
processId int The process ID.
return bool
Esempio n. 1
0
        /// <devdoc>
        ///    <para>
        ///       Returns a new <see cref='System.Diagnostics.Process'/> component given a process identifier and
        ///       the name of a computer in the network.
        ///    </para>
        /// </devdoc>
        public static Process GetProcessById(int processId, string machineName)
        {
            if (!ProcessManager.IsProcessRunning(processId, machineName))
            {
                throw new ArgumentException(SR.Format(SR.MissingProccess, processId.ToString()));
            }

            return(new Process(machineName, ProcessManager.IsRemoteMachine(machineName), processId, null));
        }