|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
using System;
|
|
2
|
2
|
using System.Collections.Generic;
|
|
|
3
|
+using System.Diagnostics;
|
|
3
|
4
|
using System.Linq;
|
|
4
|
5
|
using System.Threading.Tasks;
|
|
5
|
6
|
using System.Windows.Forms;
|
|
|
@@ -14,9 +15,21 @@ namespace HySoftSMS
|
|
14
|
15
|
[STAThread]
|
|
15
|
16
|
static void Main()
|
|
16
|
17
|
{
|
|
17
|
|
- Application.EnableVisualStyles();
|
|
18
|
|
- Application.SetCompatibleTextRenderingDefault(false);
|
|
19
|
|
- Application.Run(new FrmMain());
|
|
|
18
|
+ Process[] ps = Process.GetProcessesByName("HySoftSMS");
|
|
|
19
|
+
|
|
|
20
|
+ if (ps != null && ps.Length > 1)
|
|
|
21
|
+
|
|
|
22
|
+ {
|
|
|
23
|
+
|
|
|
24
|
+ //发现重复进程
|
|
|
25
|
+ MessageBox.Show("已经运行了一个实例了。");
|
|
|
26
|
+ }
|
|
|
27
|
+ else
|
|
|
28
|
+ {
|
|
|
29
|
+ Application.EnableVisualStyles();
|
|
|
30
|
+ Application.SetCompatibleTextRenderingDefault(false);
|
|
|
31
|
+ Application.Run(new FrmMain());
|
|
|
32
|
+ }
|
|
20
|
33
|
}
|
|
21
|
34
|
}
|
|
22
|
35
|
}
|