Click to See Complete Forum and Search --> : Process Handle & Process ID, what is the difference?
Cy_
September 13th, 2006, 01:27 PM
Hi,
What is the difference between the Process Handle & The Process ID?
Using Spy++ I can see the Process ID but, I cannot find the Process Handle?!
thanks
wildfrog
September 13th, 2006, 02:31 PM
A process id identifies a process and is unique through out the system. A handle is unique within a single process.
So, if process A holds a handle to process T, and process B holds a handle to process T, then these two handle will/may be different.
To copy/move a handle from one process to another you can use DuplicateHandle (simply passing the handle value isn't enough).
- petter
Cy_
September 13th, 2006, 02:56 PM
A process id identifies a process and is unique through out the system. A handle is unique within a single process.
So, if process A holds a handle to process T, and process B holds a handle to process T, then these two handle will/may be different.
To copy/move a handle from one process to another you can use DuplicateHandle (simply passing the handle value isn't enough).
- petter
Petter,
Thanks for the explanation, things are more clear now. However:
1- "Will/May" or MUST? can 2 Process Handles be the same within the same Process ID?
2- If everything has a HWND that identifies the process exclusively then why is a Process Handle necessary?
3- How can one see the Process Handle? like by Spy++ or is there a tool etc.?
thanks
Cy
wildfrog
September 13th, 2006, 03:04 PM
1- "Will/May" or MUST? can 2 Process Handles be the same within the same Process ID?
One process can have multiple hadles to a process T, and all those handles will be different.
2- If everything has a HWND that identifies the process exclusively then why is a Process Handle necessary?
HWND is a handle to a window, not a process.
3- How can one see the Process Handle? like by Spy++ or is there a tool etc.?Well, there is no such thing as the process handle. There can be many handles to a single process. AFAIK www.sysinternals.com has such an utility.
- petter
Cy_
September 18th, 2006, 03:04 PM
petter,
thanks for the useful link...:)
Cy
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.