Application.Exit()
-
In my application I have restricted to the 2nd instant of application giving below code, s_Mutex = new Mutex(true, "MyApp"); if (s_Mutex.WaitOne(0, false)) { Application.Run(new frmSocket()); } else { MessageBox.Show("Another instance is running"); } Also im using a Logoff button in my application and and have used below code, System.Windows.Forms.Application.Exit(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); Problem when I press log off button it cause to 2nd instant ans show the message ("Another instance is running") I want to run appication again beeing restricting 2nd instant. How ovecome that issue.
-
In my application I have restricted to the 2nd instant of application giving below code, s_Mutex = new Mutex(true, "MyApp"); if (s_Mutex.WaitOne(0, false)) { Application.Run(new frmSocket()); } else { MessageBox.Show("Another instance is running"); } Also im using a Logoff button in my application and and have used below code, System.Windows.Forms.Application.Exit(); System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); Problem when I press log off button it cause to 2nd instant ans show the message ("Another instance is running") I want to run appication again beeing restricting 2nd instant. How ovecome that issue.
You need to close mutex when you no longer need it. Making the Application Single-instance[^]
Giorgi Dalakishvili #region signature my articles #endregion
-
You need to close mutex when you no longer need it. Making the Application Single-instance[^]
Giorgi Dalakishvili #region signature my articles #endregion
Thankz Lot... i used, s_Mutex.Close() after Application.Run(.... statement Grate!!