Windows application developer some required that to run single instance of the application. I want to share with you geeks how I can do it in the .Net application. I don’t know how many of you guys know that this thing, but if you have another better way of doing this task so please give comments on blog.
Note: Please change the appName variable with your application name.
bool exclusive;
string appName = "CustomDictionary";
System.Threading.Mutex m = new System.Threading.Mutex(true, appName, out exclusive);
if (!exclusive)
{
MessageBox.Show("Another instance of " + Application.ProductName + " is running.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}