45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace GetData_PLC
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// 应用程序的主入口点。
|
|
/// </summary>
|
|
[STAThread]
|
|
|
|
static void Main()
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
//frmMain frmMainSingle = frmMain.getSingle();
|
|
//Application.Run(frmMainSingle);
|
|
|
|
|
|
|
|
bool createdNew; Mutex instance = new Mutex(true, "互斥名(保证在本机中唯一)", out createdNew);
|
|
if (createdNew)
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.Run(new frmMain());
|
|
instance.ReleaseMutex();
|
|
}
|
|
|
|
else
|
|
{
|
|
MessageBox.Show("已经启动了一个程序,请先退出!", "系统提示", MessageBoxButtons.OK,
|
|
MessageBoxIcon.Error);
|
|
Application.Exit();
|
|
}
|
|
}
|
|
}
|
|
}
|