GetCurrentProcessId
The GetCurrentProcessId function returns the process identifier of the calling process.
Syntax
DWORD GetCurrentProcessId(void);
Parameters
This function does not take any parameters.
Return Value
If the function succeeds, the return value is the identifier of the calling process.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The process identifier is a unique value assigned to each process by the system. It can be used to identify a process.
A process identifier is not necessarily unique over the lifetime of the system. It is unique only for the lifetime of the process. After a process terminates, its identifier can be reused by a new process.
Requirements
| Interface | Version |
|---|---|
| Process Threads API | Windows Vista, Windows 7, Windows 8, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2 |
| Kernel32.lib | Implemented in Kernel32.dll |