时间:2020-11-03 13:36:54 | 栏目:.NET代码 | 点击:次
本文实例讲述了C#获取任务栏显示进程的方法。分享给大家供大家参考。具体实现方法如下:
private static void getWindowsInfo() { try { Process[] MyProcesses = Process.GetProcesses(); string[] Minfo = new string[6]; foreach (Process MyProcess in MyProcesses) { if (MyProcess.MainWindowTitle.Length > 0) { Minfo[0] = MyProcess.MainWindowTitle; Minfo[1] = MyProcess.Id.ToString(); Minfo[2] = MyProcess.ProcessName; Minfo[3] = MyProcess.StartTime.ToString(); Console.WriteLine("标题:" + Minfo[0]); Console.WriteLine("编号:" + Minfo[1]); Console.WriteLine("进程:" + Minfo[2]); Console.WriteLine("开始时间" + Minfo[3]); Console.WriteLine(); } } } catch { } }
希望本文所述对大家的C#程序设计有所帮助。