Created
January 29, 2019 02:47
-
-
Save sailfish009/8faf0e5153ae8704416ec3e21fdb6cc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
namespace Server | |
{ | |
static class Program | |
{ | |
/// <summary> | |
/// The main entry point for the application. | |
/// </summary> | |
[STAThread] | |
static void Main() | |
{ | |
Process[] p = Process.GetProcessesByName("yourApp"); | |
if (p.Length > 1) | |
{ | |
MessageBox.Show("app is already running!", | |
"app running", | |
MessageBoxButtons.OK, | |
MessageBoxIcon.Hand); | |
// p[1].Kill(); | |
return; | |
} | |
Application.EnableVisualStyles(); | |
Application.SetCompatibleTextRenderingDefault(false); | |
Application.Run(new Form1()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment