1

here is my problem:

For example, lets say I have Chrome running with 5 tabs, this will create 6 processes called Chrome.exe, one for chrome and one each for the tabs.

Now using Process.GetProcessesByName("chrome") will return all 6 processes.

How can I work out which of the processes is the main one?

It is possible as this is what Process Explorer does: alt text

Basically I want to get the handle for the master chrome process, how do I do this?

Ozzy
  • 10,285
  • 26
  • 94
  • 138
  • Not entirely sure but what happens if you break a tab off? My guess is it still falls under the single chrome.exe node. My curiosity is whether your are assuming physical view ie...tab within Chrome is identical to multiple instances...I believe they are one in the same. Would be interested to see how 3 different processes of an application look like in process explorer as I don;t recall what it will look like. – Aaron McIver Dec 15 '10 at 22:14

2 Answers2

3

It really depends on the process you want to study/analyze. Only processes know how they behave internally.

In the specific Chrome case, you can check which one is the parent of others.

Here is a link to determine a process parent: How to get parent process in .NET in managed way

Community
  • 1
  • 1
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
0
  1. Look at all the "chrome.exe" processes
  2. The one that's the parent of all the others is the main one
Anon.
  • 58,739
  • 8
  • 81
  • 86
  • 1
    +0: I think you misread the question. The OP wanted to know how to do that in code. He was using Process Explorer as an example of a program that did so successfully. – Brian Jan 05 '11 at 15:25