-
August 1st, 2007, 03:11 AM
#1
Handle of process to process id
When spawnX() starts a process in asynchronous mode it returns the handle of the new process. Somne functions dealing with processes e.g. GetWindowsThreadProcessID() return the processes ID. What's the relationship between handle and id? Is there a function for transformation?
Thanks in advance for your reply!
-
August 1st, 2007, 07:07 AM
#2
Re: Handle of process to process id
An ID identifies the process and/or thread in your current windows session. To gain access to a thread/process (e.g. to check its status, kill it and so on) you need to "open" the Process. The open process takes the ID (to lookup the right process you are looking for) and returns the handle. The handle may store additional information along: Do you have termination rights? Do you have read/write rights? And so forth. The handle then may be passed to other functions like TerminateThread and so on.
-
August 1st, 2007, 07:15 AM
#3
Re: Handle of process to process id
There is no conversion from handle to ID, but one can call OpenProcess(ID) to get the handle.
If you use CreateProcess to spawn/create the process, then you get the handle and ID both in PROCESS_INFORMATION structure.
Regards,
Ramkrishna Pawar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|