Get a reference to the current process and use System.Diagnostics‘s Process.Id property:
int nProcessID = Process.GetCurrentProcess().Id;
Get a reference to the current process and use System.Diagnostics‘s Process.Id property:
int nProcessID = Process.GetCurrentProcess().Id;