Re: [問題] 請問如何判斷某個exe檔是否開啟

作者: testPtt (測試)   2016-03-25 16:37:53
貼在main()中 看需求修改:
int processCount = 0;
Process[] pa = Process.GetProcesses();
foreach (Process PTest in pa)
{
if (PTest.ProcessName ==
Process.GetCurrentProcess().ProcessName)
{
processCount += 1;
}
}
if (processCount > 1)
{
DialogResult dr;
dr = MessageBox.Show(Process.GetCurrentProcess().ProcessName
+ "程式已經執行", "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
作者: bill0205 (善良的小孩沒人愛)   2016-03-25 17:01:00
感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com