日期:2014-05-17 浏览次数:21002 次
static void Main(string[] args)
{
Process p = new Process();
p.StartInfo.FileName = "notepad.exe";
p.Start();
Console.WriteLine(" 进程ID:" + p.Id);
Console.WriteLine("进程名称:" + p.ProcessName);
Console.WriteLine("文件定位:" + p.MainModule.FileName);
Console.ReadKey();
}
Task task = taskFactory.StartNew(() => {
this.listBoxControl1.BeginInvoke((MethodInvoker)delegate {
this.listBoxControl1.Items.Clear();
Process[] processes = Process.GetProcesses();
foreach (var item in processes)
{
this.listBoxControl1.Items.Add(item.ProcessName);
try
{
this.listBoxControl1.Items.Add( item.MainModule.FileName.Substring(0, item.MainModule.FileName.LastIndexOf("\\")));
}
catch (Win32Exc