Kernel32OpenProcess(GenericAccessRights, Boolean, Int32) Method
Opens an existing local process object.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static SafeProcessHandle OpenProcess(
GenericAccessRights desiredAccess,
bool inheritHandle,
int pid
)
<DllImportAttribute("Kernel32.dll", CharSet := CharSet.Unicode, SetLastError := true>]
Public Shared Function OpenProcess (
desiredAccess As GenericAccessRights,
inheritHandle As Boolean,
pid As Integer
) As SafeProcessHandle
Dim desiredAccess As GenericAccessRights
Dim inheritHandle As Boolean
Dim pid As Integer
Dim returnValue As SafeProcessHandle
returnValue = Kernel32.OpenProcess(desiredAccess,
inheritHandle, pid)
public:
[DllImportAttribute(L"Kernel32.dll", CharSet = CharSet::Unicode, SetLastError = true)]
static SafeProcessHandle^ OpenProcess(
GenericAccessRights desiredAccess,
bool inheritHandle,
int pid
)
[<DllImportAttribute("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)>]
static member OpenProcess :
desiredAccess : GenericAccessRights *
inheritHandle : bool *
pid : int -> SafeProcessHandle
No code example is currently available or this language may not be supported.
- desiredAccess GenericAccessRights
-
The access to the process object.
This access right is checked against the security descriptor for the process.
- inheritHandle Boolean
-
If this value is , processes created by this process will inherit the handle.
Otherwise, the processes do not inherit this handle.
- pid Int32
-
The identifier of the local process to be opened
SafeProcessHandle
If the function succeeds, the return value is an open handle to the specified process.
If the function fails, the return value is
Zero.
To get extended error information, call
GetLastWin32Error.