Living .NET...

Musings on .NET, and the like - Manoj G [MVP, Connected Systems Developer]

Singleton applications

I think it is a fairly common requirement to develop applications such that only a single instance runs at a time. This is where Mutexes, an inter-process thread synchronization primitive comes into picture. This is one good example where no other WaitHandle, but Mutexes only can be employed. For the implementation details, you can refer to Jon Skeet's most excellent C# FAQ.

I believe another way is to check if Process.GetProcessByName(“<<App Name>>“) returns a non-empty array. This approach may work fine, but I don't seem to like this personally.

Come Whidbey, you need not bother about using any of the above methodologies, as this is as easy as setting a project property!

 

Posted: Thu, Jan 20 2005 20:26 by Manoj G | with 1 comment(s)
Filed under:

Comments

Manoj G said:

sorry but this is comment spam from a fellow MVP.
it was posted by an automated bot i wrote.
it uses AI to beat the CAPTCHA test.
i have written an article about it here.
http://www.brains-N-brawn.com/aiCAPTCHA
# January 30, 2005 11:20 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)