C# ????????????????
???????????? ???????[ 2014/8/21 13:47:14 ] ????????C# ????
????1. ???????????????????????
????2. ???????????????????
????3. ??????????????????????
????4. ??????????????????????????
// using System.Diagnostics;
private string appName = "calc.exe";
/// <summary>
/// 1. ???????????????????
/// </summary>
private void button1_Click(object sender?? EventArgs e)
{
Process.Start(appName);
MessageBox.Show(String.Format("?????? {0} ???????"?? this.appName)?? this.Text??
MessageBoxButtons.OK?? MessageBoxIcon.Information);
}
/// <summary>
/// 2. ?????????????????
/// </summary>
private void button2_Click(object sender?? EventArgs e)
{
try
{
Process proc = Process.Start(appName);
if (proc != null)
{
proc.WaitForExit(3000);
if (proc.HasExited) MessageBox.Show(String.Format("?????? {0} ????????"?? this.appName)?? this.Text??
MessageBoxButtons.OK?? MessageBoxIcon.Information);
else
{
// ???????????н??????????????????
proc.Kill();
MessageBox.Show(String.Format("?????? {0} ??????????"?? this.appName)?? this.Text?? MessageBoxButtons.OK?? MessageBoxIcon.Exclamation);
}
}
}
catch (ArgumentException ex)
{
MessageBox.Show(ex.Message?? this.Text?? MessageBoxButtons.OK?? MessageBoxIcon.Error);
}
}
/// <summary>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11