Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Process.Handle Property

Returns the associated process's native handle.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public IntPtr Handle { get; }
/** @property */
public IntPtr get_Handle ()

public function get Handle () : IntPtr

Property Value

The handle that the operating system assigned to the associated process when the process was started. The system uses this handle to keep track of process attributes.
Exception typeCondition

InvalidOperationException

The process has not been started. The Handle property cannot be read because there is no process associated with this Process instance.

-or-

The Process instance has been attached to a running process but you do not have the necessary permissions to get a handle with full access rights.

NotSupportedException

You are trying to access the Handle property for a process running on a remote computer.

An application can obtain a handle to a process that can be used as a parameter to many process-information and control functions. You can use this handle to initialize a WaitHandle or to call native methods with platform invoke.

This process handle is private to an application--in other words, process handles cannot be shared. A process also has a process Id which, unlike the Handle, is unique and, therefore, valid throughout the system.

Only processes started through a call to Start set the Handle property of the corresponding Process instances.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.