Code Snippet posted by:
Sakthi.Singaravel | Posted on: 4/23/2012 | Category:
C# Codes | Views: 498 | Status:
[Member] |
Points: 40
|
Alert Moderator
In button event to kill a word process, code as follows..
private void button3_Click(object sender, EventArgs e)
{
Process[] ExistingProcess = null;
Process ChkProcess = null;
ExistingProcess = Process.GetProcessesByName("winword");
foreach (Process ChkProcess_loopVariable in ExistingProcess)
{
ChkProcess = ChkProcess_loopVariable;
if ((ChkProcess.ProcessName) == "WINWORD")
{
ChkProcess.Kill();
MessageBox.Show ( "Deleted");
}
}
}
Regards,
Singaravel M