65.9K
CodeProject is changing. Read more.
Home

Single instance app in C#

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.35/5 (14 votes)

Jan 4, 2004

viewsIcon

34711

downloadIcon

1354

Sample for demonstrating interprocess communication using same application.

Introduction

This application ensures that only a single instance of an application exists. If any attempt is made to launch the application a second time, the command line parameters are sent to the already running instance and the second instance is terminated.

This application is the C# equivalent of an already posted article demonstrating the single instance behavior of an application.

This application takes in a command line argument and displays it in the edit box of the form. When this application is launched for the second time, it simply updates the edit box of the already running application instead of creating a new instance.