Wednesday 20 July 2016

Check current application running or not C# WPF

const string appGuid = "Sample-d693gba6e9d1";  //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.");
                return;
            }


            GC.KeepAlive(mutex);

No comments:

Post a Comment