Try this:
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
if (!string.IsNullOrWhiteSpace(p.MainWindowTitle))
{
Console.WriteLine(p.ProcessName + ".exe");
Console.WriteLine(" " + p.MainWindowTitle);
Console.WriteLine("");
}
}
You may have to do some "playing" to get exactly what task manager does - I suspect it "knows" about some applications and intelligently massages the displayed data. But that should give you a start.
[edit]Better exclusion function.[/edit]