using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
Process theProc = null;
try
{
theProc = Process.GetProcessById(12344);
}
catch
{
Console.WriteLine("-> Sorry...bad PID!");
return;
}
Console.WriteLine("Here are the threads used by: {0}",theProc.ProcessName);
ProcessThreadCollection theThreads = theProc.Threads;
foreach (ProcessThread pt in theThreads)
{
string info = string.Format("-> Thread ID: {0}\tStart Time {1}\tPriority {2}",pt.Id, pt.StartTime.ToShortTimeString(), pt.PriorityLevel);
Console.WriteLine(info);
}
}
}
|