原文地址 :http://www.cnblogs.com/emanlee/archive/2009/08/31/1557379.html using System; using System.Threading; using System.Collections.Generic; using System.Windows.Forms; namespace ArresterSerialPort { static class Program { /// <summary> /// The main…
程序运行过程中,不能有多个实例运行,并且需要程序自己可以重启(重新运行),所以代码如果下代码: static void Main() { bool createNew; using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out createNew)) { if (createNew) { Application.EnableVisualStyles(); Appl…
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Diagnostics; using System.Reflection; namespace AppLed { static class Program { //防止程序运行多个实例的方法有多种,如:通过使用互斥…
只启动一个exe方法: using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Windows.Forms; namespace StringToImage { static class Program { [DllImport("user32.dll")] public static extern IntPtr FindWindow(Strin…