Recent Posts

Wednesday, August 6, 2008

How to check if the previous instance of the Application is already running in c#.Net

The following code illustrates how to check if previous instance of the application is running

using System.Diagnostics;

public void CheckForExistingInstance()
Process process = Process.GetCurrentProcess();

if (Process.GetProcessesByName(process.ProcessName).Length > 1)
MessageBox.Show("Another Instance of this process is already Running",
"Multiple Instance Forbidden", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);


Related Posts by Categories

No comments:

Post a Comment