Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to check witch programing running in user windows or Linux in my Program. I use the below code, However this code show me every process name even the services.
But I don't want the services name. I only Want the program user running.
please help me

What I have tried:

Process[] processlist = Process.GetProcesses();

foreach (Process theprocess in processlist)
{
      MessageBox.Show("Process: " + theprocess.ProcessName) ;
    }
}
Posted
Comments
Member 13566383 23-Oct-20 3:03am    
Have you tried to use Process.MainWindowHandle Property?

If the associated process does not have a main window, the MainWindowHandle value is zero.
link1234 23-Oct-20 3:27am    
Thank you. my problem solved, But some program like calculator and edge still detected even when the user not open it. I Think maybe I should filter this app with some if or find why to not show my this to.
and I have another Question, are this code work on Linux and mac in same way or I Should create different method for them?

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