Question

What's the simplest way to obtain the current process ID from within your own application, using the .NET Framework?

Was it helpful?

Solution

Get a reference to the current process and use System.Diagnostics's Process.Id property:

int nProcessID = Process.GetCurrentProcess().Id;

OTHER TIPS

Process.GetCurrentProcess().Id
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top