GetCurrentProcessId (kernel32)
Last changed: -186.136.223.176

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern uint GetCurrentProcessId();

VB Signature:

  Declare Function GetCurrentProcessId Lib "kernel32" () As Integer

Boo Signature:

[DllImport("kernel32.dll")]
def GetCurrentProcessId() as UInt32:
     pass

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

  class FindMyself
  {
    [DllImport("kernel32.dll")]
    public static extern uint GetCurrentProcessId();
  }

  class WhoAmI
  {
    private void LookUp()
    {
      uint MyID = FindMyself.GetCurrentProcessId();
    }
  }

Alternative Managed API:

Process.GetCurrentProcess().Id

Documentation