我正在开发WPF应用程序的某些部分。我为它创建了多个用户控件。所以,我的一个用户控件,我打开IExplore.exe带有一个URL。关闭该用户控件后,我关闭该进程。在我的系统上似乎工作正常,但使用我的用户控件的客户端机器似乎不像我想要的那样工作。关闭Iexplore.exe这是正确的,但当我看着“任务管理器”,我看到太多iexplore.exe。有些Iexplore.exe无法关闭,所以使用此名称选项杀死所有进程选项对我来说不是一种选择:)C# - 杀死进程无法正常工作
这是我的启动过程类。
class ses_process
{
static Process p = new Process();
private Process Proc;
public static bool start(string url)
{
p = Process.Start("IEXPLORE.EXE", "-nomerge "+url);
//startInfo.WindowStyle = ProcessWindowStyle.Maximized;
return true;
}
public static bool stop()
{
p = Process.GetProcessById(p.Id);
bool return_deger = p.CloseMainWindow();
return return_deger;
}
public Process proc
{
get { return Proc; }
set
{
if (Proc == null)
{
Proc = p;
}
}
}
}
它在任务管理器上看起来像这样;
iexplore.exe 16524 Console 10 20.268 K
iexplore.exe 22572 Console 10 40.636 K
iexplore.exe 2356 Console 10 109.452 K
calc.exe 20572 Console 10 11.208 K
wuauclt.exe 11716 Console 10 1.092 K
RuntimeBroker.exe 6096 Console 10 3.180 K
iexplore.exe 10660 Console 10 16.536 K
iexplore.exe 18272 Console 10 71.972 K
iexplore.exe 20996 Console 10 15.004 K
iexplore.exe 14188 Console 10 2.080 K
iexplore.exe 12664 Console 10 15.120 K
iexplore.exe 5612 Console 10 27.660 K
iexplore.exe 18772 Console 10 15.572 K
iexplore.exe 22568 Console 10 35.944 K
iexplore.exe 21796 Console 10 14.852 K
iexplore.exe 10524 Console 10 19.100 K
iexplore.exe 13984 Console 10 14.808 K
iexplore.exe 21088 Console 10 19.664 K
iexplore.exe 10856 Console 10 14.008 K
iexplore.exe 1048 Console 10 12.652 K
iexplore.exe 22236 Console 10 15.428 K
iexplore.exe 15584 Console 10 24.204 K
iexplore.exe 16248 Console 10 6.116 K
iexplore.exe 9684 Console 10 3.064 K
iexplore.exe 752 Console 10 14.480 K
iexplore.exe 12680 Console 10 19.004 K
iexplore.exe 5772 Console 10 14.064 K
iexplore.exe 17868 Console 10 18.872 K
iexplore.exe 9272 Console 10 5.644 K
iexplore.exe 14216 Console 10 3.332 K
iexplore.exe 6060 Console 10 11.820 K
iexplore.exe 21352 Console 10 12.592 K
iexplore.exe 19604 Console 10 15.392 K
iexplore.exe 16636 Console 10 23.916 K
iexplore.exe 12584 Console 10 14.796 K
iexplore.exe 2848 Console 10 21.884 K
iexplore.exe 13696 Console 10 5.608 K
iexplore.exe 11720 Console 10 3.296 K
SearchProtocolHost.exe 20896 Console 10 2.404 K
您可能需要权限才能终止该进程。 – Lloyd
IE中的插件/扩展有可能像Chrome一样拥有自己的进程吗? –
你确定你只开始一次吗?同一台机器上有多少用户同时打开IE? – sirdank