Method 1:
Add the following code to your startup window (which is usually App.xaml.cs) after InitializeComponent().
Process thisProcess = Process.GetCurrentProcess();
if(Process.GetProcessesByName(thisProcess.ProcessName).Length >1 )
{// If ther is more than one, than it is already running. MessageBox.Show("Another instance of your app is already running."); Application.Current.Shutdown(); return;
}
No comments:
Post a Comment