Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function returns a handle to an existing process object. When you finish with the handle, close it using the CloseHandlefunction.

Syntax

HANDLE OpenProcess(
  DWORD 
fdwAccess,
  BOOL 
fInherit,
  DWORD 
IDProcess
);

Parameters

fdwAccess

[in] Not supported; set to zero.

fInherit

[in] Not supported; set to FALSE.

IDProcess

[in] Specifies the process identifier of the process to open.

Return Value

An open handle to the specified process indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

The handle returned by the OpenProcessfunction can be used in any function that requires a handle to a process, such as wait functions, if the appropriate access rights are requested. A normal process cannot get a handle to a privileged process.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also