http://msdn.microsoft.com/zh-cn/library/z3w4xdc9.aspx
通过其方法getprocessbyname() --其参数为进程名字可返回进程组件的数组process[]
代码示例:
通过其方法getprocessbyname() --其参数为进程名字可返回进程组件的数组process[]
代码示例:
namespace MyProcessSample { /// /// Shell for the sample. /// class MyProcess { void BindToRunningProcesses() { // Get the current process.提取当前进程 Process currentProcess = Process.GetCurrentProcess(); 提取本机运行notepad程序的所有进程实例 // Get all instances of Notepad running on the local // computer. Process [] localByName = Process.GetProcessesByName("notepad"); // Get all instances of Notepad running on the specifiec // computer. // 1. Using the computer alias (do not precede with "\\"). 查询特定机子上面应用程序的进程信息
Process [] remoteByName = Process.GetProcessesByName("notepad", "myComputer"); // 2. Using an IP address to specify the machineName parameter. 查询某个IP且应用程序的进程信息
Process [] ipByName = Process.GetProcessesByName("notepad", "169.0.0.0"); 查本机所有进程信息 // Get all processes running on the local computer. Process [] localAll = Process.GetProcesses(); // Get all processes running on the remote computer. Process [] remoteAll = Process.GetProcesses("myComputer"); --通过具体进程号查看进程信息(本机) // Get a process on the local computer, using the process id. Process localById = Process.GetProcessById(1234); // Get a process on a remote computer, using the process id. Process remoteById = Process.GetProcessById(2345, "myComputer"); } static void Main() { MyProcess myProcess = new MyProcess(); myProcess.BindToRunningProcesses(); } } }
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-709707/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-709707/