xtd 0.2.0
Loading...
Searching...
No Matches

◆ handle()

intptr xtd::diagnostics::process::handle ( ) const

Gets the native handle of the associated process.

Returns
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.
Exceptions
xtd::invalid_operation_exceptionThe process has not been started or has exited. The xtd::diagnostics::process::handle property cannot be read because there is no process associated with this xtd::diagnostics::process instance.
-or-
The xtd::diagnostics::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.
xtd::not_supported_exceptionYou are trying to access the xtd::diagnostics::process::handle property for a process that is running on a remote computer. This property is available only for processes that are running on the local computer.
Remarks
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 xtd::diagnostics::wait_handle 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 xtd::diagnostics::process::handle, is unique and, therefore, valid throughout the system.
Only processes started through a call to xtd::diagnostics::process::start set the xtd::diagnostics::process::handle property of the corresponding xtd::diagnostics::process instances.