GetCurrentProcessId function (processthreadsapi.h)

Retrieves the process identifier of the calling process.

Syntax

DWORD GetCurrentProcessId();

Return value

The return value is the process identifier of the calling process.

Remarks

Until the process terminates, the process identifier uniquely identifies the process throughout the system.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header processthreadsapi.h (include Windows.h on Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 Windows Server 2008 R2)
Library Kernel32.lib
DLL Kernel32.dll

See also

GetCurrentProcess

OpenProcess

Process and Thread Functions

Processes