SingleApplication.cs
/// <summary>
/// check if given exe alread running or not
/// </summary>
/// <returns>returns true if already running</returns>
check if given exe alread running or not
check if given exe alread running or not
private static bool IsAlreadyRunning()
        {
            string strLoc = Assembly.GetExecutingAssembly().Location;
            FileSystemInfo fileInfo = new FileInfo(strLoc);
            string sExeName = fileInfo.Name;
            bool bCreatedNew;
            mutex = new Mutex(true, "Global\\" + sExeName, out bCreatedNew);
            if (bCreatedNew)
                mutex.ReleaseMutex();
            return !bCreatedNew;
        }
private static bool IsAlreadyRunning ( ) { string strLoc = Assembly . GetExecutingAssembly ( ) . Location ; FileSystemInfo fileInfo = new FileInfo ( strLoc ) ; string sExeName = fileInfo . Name ; bool bCreatedNew ; mutex = new Mutex ( true , " \\ " + sExeName , out bCreatedNew ) ; if ( bCreatedNew ) mutex . ReleaseMutex ( ) ; return ! bCreatedNew ; }
check if given exe alread running or not
check if given exe alread running or not
returns true if already running
returns true if already running