7 out of 12 rated this helpful - Rate this topic

GetCurrentProcessId function

Applies to: desktop apps | Metro style apps

Retrieves the process identifier of the calling process.

Syntax

DWORD WINAPI GetCurrentProcessId(void);

Parameters

This function has no parameters.

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

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetCurrentProcess
OpenProcess
Process and Thread Functions
Processes

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
C# syntax
[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern uint GetCurrentProcessId();
vb.net syntax
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function GetCurrentProcessId() As UInt32 End Function