PerfectPhase wrote:

mot256 wrote:
PerfectPhase wrote: Why not just check the process list for the app? 

I'll love to know how?


http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.getprocessesbyname.aspx


Use this approach only if you are using .NET 2.0 for your applicaiton.

In .NET 1.1, when the Process object is instantiated, it gathers performance information of the process. This may fail if the performancing has been turned off or the user is denied permission to do so.

I had used this approach for a fairly large WinForms app written in .NET 1.1 and never had a clue of this issue. We realised it when the when the application threw wired exceptions on the Product Manager's laptop [fortunately not in a sales pitch Smiley]
Googling around it might get you more details.

If you are using .NET 2.0 to do this, I'd suggest you to use the other single instance approach mentioned here (that uses VB assemblies). There is a MSDN mag article around it as well.

Hope that helps.

Edit: Having said all this, the Process approach has another drawback of the user being able to rename the Exe and the Config files and run a second instance of the application [already mentioned in other posts]. There is probably nothing you can do to stop this.