Wednesday, July 29, 2009

Single Instance Application in C#

Introduction
Single-instance an application means enabling the application to recognize, at startup, if another running instance of itself is already running, In this case, the new application stops its execution. Generally, for a form based application, the new instance activates (brings the application window to foreground) the previous instance, if its already running.

Using the code
To make a single instance application, add file SingleApplication.cs in your project. It adds a new class SingleApplication defined in namespace SingleInstance and adds the following code for a form based application to your startup code:


See full detail: http://www.codeproject.com/KB/cs/singleinstance.aspx

No comments: