473,587 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between ProcessID and Handle

Dim p As Diagnostics.Pro cess
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 1816
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******@hotma il.com> wrote in message
news:29******** *************** *******@news.te ranews.com...
Dim p As Diagnostics.Pro cess
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@@m sn.com> wrote in message
news:u8******** ******@TK2MSFTN GP09.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******@hotma il.com> wrote in message
news:29******** *************** *******@news.te ranews.com...
Dim p As Diagnostics.Pro cess
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
1271
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 'System.Xml.XPath.XPathSelectionIterator', while the result should be 2. Can someone help me out solve this problem.
17
760
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
8724
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 conceptually speaking : when do I define something as 'struct' and when as 'class' ? for example : if I want to represent a 'Time' thing, containing...
1
21291
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
29898
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 i really can see the difference between these two methods... they're all talking about 2 message loops and com interop... but what benefit does...
1
1159
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 Installed system.In framework installed system i am getting the error as follows. "ProcessId and Thread ID Exceptions" i have used 3rd party dlls int this...
8
12759
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 to me please? A) protected static extern IntPtr GetWindowDC (IntPtr hWnd );
1
7487
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 when I use wcstombs instead of widechartomultibyte function. Why is it so? Can anybody please help? following is my code: #define _UNICODE
15
6411
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 but that only gave me difference in hours and only if the times were on the same day (after wrapping with date() function). TIA
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.