using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace School.ReadPaperControl
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// 控制仅打开单实例进程
if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length == 0)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmControl());
}
}
}
}
本文介绍了一个简单的C#应用程序,该程序确保在同一时间内只运行一个实例。通过检查当前进程中是否有同名进程正在运行来实现这一目标。
2166

被折叠的 条评论
为什么被折叠?



