Guest User

Untitled

a guest
Dec 3rd, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1.     static class Program
  2.     {
  3.         /// <summary>
  4.         /// The main entry point for the application.
  5.         /// </summary>
  6.         [STAThread]
  7.         static void Main()
  8.         {
  9.             Application.EnableVisualStyles();
  10.             Application.SetCompatibleTextRenderingDefault(false);
  11.             bool existed;
  12.             string guid = Marshal.GetTypeLibGuidForAssembly(Assembly.GetExecutingAssembly()).ToString();
  13.  
  14.             Mutex mutexObj = new Mutex(true, guid, out existed);
  15.             if(existed)
  16.                 Application.Run(new MainForm());
  17.             else
  18.             {
  19.                 MessageBox.Show("Приложение уже запущенно");
  20.                 Application.Exit();
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment