[STAThread]
public static void Main(string[] args)
{
//声明互斥体。
Mutex mutex = new Mutex(false, "Test");
//判断互斥体是否使用中。
bool Running = !mutex.WaitOne(0, false);
if (! Running)
new FormTest().ShowDialog();
else
MessageBox.Show("窗体已打开");
public static void Main(string[] args)
{
//声明互斥体。
Mutex mutex = new Mutex(false, "Test");
//判断互斥体是否使用中。
bool Running = !mutex.WaitOne(0, false);
if (! Running)
new FormTest().ShowDialog();
else
MessageBox.Show("窗体已打开");