You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
975 B
40 lines
975 B
using DevicesService.Commen; |
|
using DevicesService.Common; |
|
using System; |
|
using System.Diagnostics; |
|
using System.Runtime.InteropServices; |
|
using System.Threading; |
|
using System.Threading.Tasks; |
|
|
|
namespace DevicesService |
|
{ |
|
internal class Program |
|
{ |
|
/// <summary> |
|
/// 应用程序的主入口点。 |
|
/// </summary> |
|
[STAThread] |
|
static void Main(string[] args) |
|
{ |
|
// 更改为你想检查的进程名称 |
|
new COMUtils(); |
|
while (true) |
|
{ |
|
Task.Delay(2000).Wait(); |
|
} |
|
} |
|
static bool IsProgramRunning(string programName) |
|
{ |
|
Process[] processes = Process.GetProcesses(); |
|
foreach (Process process in processes) |
|
{ |
|
if (process.ProcessName.Equals(programName)) |
|
{ |
|
return true; |
|
} |
|
} |
|
return false; |
|
} |
|
|
|
} |
|
}
|
|
|