比较简洁的Singleton Proces(唯一进程)程序

         static   void  Main()
        
{
            
bool newMutexCreated = true;
            
using (new Mutex(true, Assembly.GetExecutingAssembly().FullName, out newMutexCreated)){
                
if (!newMutexCreated) //exist
                    return;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(
false);
                Application.Run(
new ServiceForm());
            }

        }

你可能感兴趣的:(比较简洁的Singleton Proces(唯一进程)程序)