473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Difference between ProcessID and Handle

Dim p As Diagnostics.Process
Debug.WriteLine(p.Id)
Debug.WriteLine(p.Handle)

What is the difference between a process's ID and Handle

I see that they are different, and i know that the Processid is a uniqe
number given to each process as they are created, but what is the handle?

do all processes have a handle and do you use them for?
Nov 20 '05 #1
3 1804
The ID is just a number assigned to the process by the system.
The Handle is a handle to a process "object" maintained by the system. This
object holds a number of pieces of info about the process, and you can use
various kernel, threading, and security API functions to retrieve/set this
data by providing the Handle. Unless you have some bizzar piece of data that
you need that isn't available directly in .NET, you really don't care much
about the Handle.

-Rob Teixeira [MVP]

"Jarod_24" <ja******@hotmail.com> wrote in message
news:29******************************@news.teranew s.com...
Dim p As Diagnostics.Process
Debug.WriteLine(p.Id)
Debug.WriteLine(p.Handle)

What is the difference between a process's ID and Handle

I see that they are different, and i know that the Processid is a uniqe
number given to each process as they are created, but what is the handle?

do all processes have a handle and do you use them for?

Nov 20 '05 #2
"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
The ID is just a number assigned to the process by the system.
The Handle is a handle to a process "object" maintained by the system. This object holds a number of pieces of info about the process, and you can use various kernel, threading, and security API functions to retrieve/set this
data by providing the Handle. Unless you have some bizzar piece of data that you need that isn't available directly in .NET, you really don't care much
about the Handle.

So a handle is a pointer to the Process-object that the OS creates to
administrate the running process itself; A pointer to a memory-location
perhaps, while the ProcessId is just a uniqe number that each process gets.

What was the point of the processid then?

Both are uniqe, What's the diference about pointing to a memory location or
just using a "number", when you must ask the OS anyway if you are going to
do anything. Then the OS itself internally can/must lookup the
Memory-adress.
-Rob Teixeira [MVP]

"Jarod_24" <ja******@hotmail.com> wrote in message
news:29******************************@news.teranew s.com...
Dim p As Diagnostics.Process
Debug.WriteLine(p.Id)
Debug.WriteLine(p.Handle)

What is the difference between a process's ID and Handle

I see that they are different, and i know that the Processid is a uniqe
number given to each process as they are created, but what is the handle?
do all processes have a handle and do you use them for?


Nov 20 '05 #3
>So a handle is a pointer to the Process-object that the OS creates

Not necessarily a pointer. You should at least not try to dereference
it.

What was the point of the processid then?


The process ID can easily be shared globally, you can pass it between
processes as a way to identify another process. The ID number is the
same regardless which process you're using it.

Process handles have access rights associated with them. You can for
example have one handle that allows you to change information about a
process, and another that only gives you right to query information.
Also, handle values are usually only useful within the process that
opened the handle. You can't pass a process handle from one
application to another and expect it to be valid at the recieving end.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Curious | last post by:
Hi, I have the following XML file. Now I am using the code below to return the number of disticnt ProcessID's in the XML file. The result being returned is the...
17
by: Nathan Given | last post by:
Hello All, I am trying to debug a broken query. The query uses Left$(,4) instead of Left(,4). What is the difference between the Left() and Left$() functions in Microsoft Access? Thanks!...
5
by: Chris | last post by:
Hi, I don't get the difference between a struct and a class ! ok, I know that a struct is a value type, the other a reference type, I understand the technical differences between both, but...
1
by: Frank | last post by:
Hello! Can somebody help me? I need to get the Process Handle for a given Process ID! Thank you Frank
19
by: Jazper Manto | last post by:
hi i read thousands of millions of articles about STA and MTA :-). everything very theoretical and i don't get it... could anybody explain me the and on a nice, small and simple example where...
1
by: Tulasi | last post by:
hi all, i am the developer of vb.net.My project everything is completed and closed.But My project is not running on Only framework installed system.The application running fine on Dot Net...
8
by: pigeonrandle | last post by:
Hi, Please pity me, i am on a dial-up connection for the first time in 5 years :( ! Does anyone know how the resulting Graphics objects differ ...? What i really mean is can someone explain it...
1
by: login | last post by:
Hi All I have russian characters in SQL database. I am fetching data using C++ code and storing it in xml file. I get right outout with widechartomultibyte. But it's not able to fetch unicode data...
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.