Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm trying to monitor all the processes on a windows system with my windows forms application using WMI. I want to know which process' are system process, which are user process(like the username in taskmanager). This is quite googleable but i also need to know which are related to windows and which are not. I haven't been able to find what i needed.
Assume my windows user name is "USER_A"; "winamp.exe" has the owner/user name as "USER_A". But "taskmgr.exe", "dwm.exe", etc also has the same user name. At first glance, path for the process (WMI, Win32_Process, ExecutablePath) is distinctive since Windows related processes are under "C:\Windows", "C:\Windows\System32" but is there any better way? Also the ones that wont need too complex(long to process) queries.


Thanks in advance.
Posted
Updated 25-May-12 16:02pm
v2

1 solution

You are right, it can be done with WMI. Please see:
http://stackoverflow.com/questions/777548/how-do-i-determine-the-owner-of-a-process-in-c[^].

—SA
 
Share this answer
 
v2
Comments
y_dev 25-May-12 22:07pm    
Thank you for your answer. My question was a little unclear, but you see your answer is not my question, i've googled and solved that part easily. My question is how to differ taskmgr.exe(or any other windows app) from winamp.exe(or any other 3rd party app) for example.
y_dev 27-May-12 11:15am    
Ouch! Sorry i was wrong your answer actually does that too. Note to self: A little sleep always helps.
Sergey Alexandrovich Kryukov 27-May-12 21:52pm    
Sure. You are very welcome.
Good luck, call again.
--SA

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