识别图形卡是板载还是PCIe

时间:2019-05-31 14:43:35

标签: c#

我正在使用以下代码来标识当前所有活动的图形卡:

    private void Read()
    {
        ManagementObjectSearcher graphicCards = new ManagementObjectSearcher("select * from Win32_VideoController");

        var allVideoControllers = graphicCards.Get();

        TotalGraphicCards = allVideoControllers.Count;

        foreach (ManagementObject obj in allVideoControllers)
        {
            //Only card which are currently actively processing
            if (obj["CurrentBitsPerPixel"] != null)
            {
                GraphicCards.Add(new GPU
                {
                    AdapterDACType = (string)obj["AdapterDACType"],
                    AdapterRAM = (uint)obj["AdapterRAM"],
                    CapabilityDescriptions = (string[])obj["CapabilityDescriptions"],
                    DeviceID = (string)obj["DeviceID"],
                    DriverVersion = (string)obj["DriverVersion"],
                    InstalledDisplayDrivers = (string)obj["InstalledDisplayDrivers"],
                    MaxRefreshRate = (uint)obj["MaxRefreshRate"],
                    Monochrome = (bool)obj["Monochrome"],
                    Name = (string)obj["Name"],
                    SystemName = (string)obj["SystemName"],
                    VideoArchitecture = (ushort)obj["VideoArchitecture"],
                    VideoMemoryType = (ushort)obj["VideoMemoryType"],
                    VideoProcessor = (string)obj["VideoProcessor"]
                });
            }

            TotalMemory += (uint)obj["AdapterRAM"];
        }

        MaxPrimaryResolution = GetMaximumPrimaryResolution();
    }

我需要确定的是回路中的当前卡是板载还是PCIe,有什么方法可以识别?

0 个答案:

没有答案