Tuesday, 17 May 2016

Check Application is running WPF winforms C#

 const string appGuid = "d693gba69d1";  //Unique App Id
            bool result;
            System.Threading.Mutex mutex = new System.Threading.Mutex(true, appGuid, out result);

            if (!result)
            {
                MessageBox.Show("Another instance is already running.  It may be loading.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            GC.KeepAlive(mutex);

No comments:

Post a Comment