system.diagnostics.process类

http://msdn.microsoft.com/zh-cn/library/z3w4xdc9.aspx

通过其方法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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值