Click here to Skip to main content
16,009,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys

I want to get all the running windows applications
to be more specific I want to get the applications shown down in the task bar
I could play and filter the process I got using Process.GetProcesses()
and display almost only the process running in taskbar (won't mid if someone will suggest a better way)

C#
if (!proc_list.Contains(proc.MainModule.FileVersionInfo.ProductName) && proc.MainModule.FileVersionInfo.FileDescription != null & proc.MainModule.FileVersionInfo.FileDescription.Length > 2))
{
    MessageBox.Show(proc.MainModule.FileVersionInfo.FileDescription);
}


whether I use FileDescription, ProductName or even window name, they both don't give the results I need, what I need is something that will show me the real application name like instead of chrome.exe it shows google chrome
so here is a sample of what I want to get exactly

http://s21.postimg.org/wvy3pcco7/Untitled.png[^]
note: 32 bit stuff are no important.

thanks in advance guys.
Posted
Comments
Nathan Minier 26-Aug-14 8:27am    
Try Process.MainWindowTitle
DeathGun 27-Aug-14 4:34am    
I tried that also but it's not the same results as the task manager, if I open a notepad .. its Window name or title is going to be Notepad - untitled or whatever that file you were opening. So this unfortunately doesn't work, thanks for your comment.

1 solution

Try this:
C#
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]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900