[STAThread]
static void Main()
{
//预防程序启动多个
bool flag=false;
System.Threading.Mutex mutex=new System.Threading.Mutex(true,"getPiValueServerManage",out flag);
if (flag)
{
Application.Run(new Form1());
mutex.ReleaseMutex(); //注意此句必须
}
else
{
MessageBox.Show("程序已经启动!");
}
}
看了网上的资料,最后发现问题在于红色部分没有加上,Mark
转自:http://hi.baidu.com/0531_sun/blog/item/3e9d69f9d8e84b50242df23a.html