using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;
namespace MyQuery.MyIE
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SingleInstanceManager manager = new SingleInstanceManager();//单实例管理器
manager.Run(new string[] { });
//Application.Run(new frmBrower());
}
}
public class SingleInstanceManager : WindowsFormsApplicationBase
{
frmBrower app;
public SingleInstanceManager()
{
this.IsSingleInstance = true;
}
protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
{
app = new frmBrower();
Application.Run(app);
return false;
}
protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
{
base.OnStartupNextInstance(eventArgs);
app.Activate();
MessageBox.Show("客户端程序已经在运行了,不能重复运行", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop);//给个对话框提示
}
}
}
欢迎访问:http://121.18.78.216 适易查询分析、工作流、内容管理及项目管理演示平台