I'm trying to create a plugin installer for IE, so before the installation continue the IE process must be kill. But when I executed the kill() method on the IE process I got "Access denied" error.
What would be the best approach for this?
My Installer code:
protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
{
if (LaunchOnBeforeInstall())
{
foreach (var process in Process.GetProcesses())
{
if (!process.ProcessName.StartsWith("iexplore"))
{
process.Kill();
}
}
base.OnBeforeInstall(savedState);
}
else
{
throw new Exception("You cancelled the installation.");
}
}
public bool LaunchOnBeforeInstall()
{
var result = MessageBox.Show("All instance of IE will be close", "Warning", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question);
return result != DialogResult.Cancel;
}
Your problem:
if (!process.ProcessName.StartsWith("iexplore"))
{
process.Kill();
}
Your program is trying to kill everything EXCEPT for Internet Explorer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With