The GetCurrentProcessId function returns the process identifier of the calling process.
DWORD GetCurrentProcessId(VOID)
This function has no parameters.
The return value is the process identifier of the calling process.
Until the process terminates, the process identifier uniquely identifies the process throughout the system.
GetCurrentProcess, OpenProcess