相关疑难解决方法(0)

在C#中以编程方式杀死进程树

我以编程方式启动Internet Explorer,代码如下所示:

ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = "http://www.google.com";
Process ieProcess = Process.Start(startInfo);
Run Code Online (Sandbox Code Playgroud)

这将生成Windows任务管理器中可见的2个进程.然后,我尝试用以下方法终止进程:

ieProcess.Kill();
Run Code Online (Sandbox Code Playgroud)

这导致任务管理器中的一个进程被关闭,另一个进程仍然存在.我尝试检查任何具有子进程的属性,但没有找到.我怎么能杀死其他进程呢?更一般地说,如何杀死与Process.Start开始的进程相关的所有进程?

.net c# kill-process

40
推荐指数
6
解决办法
4万
查看次数

使用C#在Windows上检测防病毒

有没有办法检测使用C#的机器中是否安装了防病毒软件?我知道安全中心会检测防病毒软件,但是如何在C#中检测到?

c# windows antivirus

19
推荐指数
2
解决办法
4万
查看次数

C#错误 - 找不到命名空间ManagementClass,ManagementObject和ManagementObjectCollection

所以,我在导入C#类后得到了完整的错误列表.我搜索了错误并得到了大量的点击,但他们都说只是添加System.Management命名空间,但它却给出了这些错误.

类似的问题.没有解决方案对我有用: 使用WMI ManagementObjectSearcher缺少指令或程序集引用?

名称空间'System.Management'中不存在'ManagementClass'

找不到类型或命名空间(您是否缺少using指令或程序集引用?)

类:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Net;
using System.Xml;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Threading;
using System.Management;
using Microsoft.Win32;
using System.Net.NetworkInformation;
using System.Security.Cryptography;

namespace PCID_Grabber
{

public class PCID
{
    public static string GetCPUId()
    {
        #region CPUid
        string cpuInfo = String.Empty;
        string temp = String.Empty;
        ManagementClass mc = new ManagementClass("Win32_Processor");
        ManagementObjectCollection moc = mc.GetInstances(); …
Run Code Online (Sandbox Code Playgroud)

.net c# namespaces

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×3

.net ×2

antivirus ×1

kill-process ×1

namespaces ×1

windows ×1