65.9K
CodeProject is changing. Read more.
Home

Video tip C#: Ensure only one instance is running

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Nov 2, 2011

CPOL
viewsIcon

9279

I would use a mutex object - using the process name might cause errors. Try "WaitOne" on the mutex - only the first process will be able to acquire it, and in the case of a failure, just exit.

I would use a mutex object - using the process name might cause errors. Try "WaitOne" on the mutex - only the first process will be able to acquire it, and in the case of a failure, just exit.