Вы можете использовать WMI для получения этой информации. Я использовал код ниже. Вы должны добавить ссылку на System.Management. Этот код довольно хрупкий, но он показывает, что информация доступна с использованием WMI. Посмотрите документацию по MSDN для других классов WMI, которые могут вас заинтересовать.
Private Shared Sub Main()
Dim videoControllers As ManagementObjectCollection = getManagementObjects("Win32_VideoController")
For Each controllerObj As ManagementObject in videoControllers
Dim pnpDeviceID As String = Path.GetFileName(controllerObj.Properties("PNPDeviceID").Value.ToString())
Dim deviceBus As String = getDeviceBus(pnpDeviceID)
Dim busType As String = getBusType(deviceBus)
Console.WriteLine("{0}: {1}", controllerObj.Properties("Name").Value, busType)
Next
End Sub
Private Shared Function getManagementObjects(ByVal wmiClass As String) As ManagementObjectCollection
Using searcher As ManagementObjectSearcher = New ManagementObjectSearcher(String.Format("select * from {0}", wmiClass))
Return searcher.Get()
End Using
End Function
Private Shared Function getDeviceBus(ByVal pnpDeviceID As String) As String
Dim result As String = Nothing
Dim coll As ManagementObjectCollection = getManagementObjects("Win32_DeviceBus")
For Each mobj As ManagementObject In coll
For Each props As PropertyData in mobj.Properties
If props.Name = "Dependent" AndAlso props.Value.ToString().Contains(pnpDeviceID) Then
result = mobj.Properties("Antecedent").Value.ToString().Split("="c)(1).Replace("""", "")
Exit For
End If
Next
Next
Return result
End Function
Private Shared Function getBusType(ByVal deviceBus As String) As String
Dim busTypes As Dictionary(Of Integer, String) = New Dictionary(Of Integer, String)()
busTypes.Add(-1, "Undefined")
busTypes.Add(0, "Internal")
busTypes.Add(1, "ISA")
busTypes.Add(2, "EISA")
busTypes.Add(3, "MicroChannel")
busTypes.Add(4, "TurboChannel")
busTypes.Add(5, "PCI Bus")
busTypes.Add(6, "VME Bus")
busTypes.Add(7, "NuBus")
busTypes.Add(8, "PCMCIA Bus")
busTypes.Add(9, "C Bus")
busTypes.Add(10, "MPI Bus")
busTypes.Add(11, "MPSA Bus")
busTypes.Add(12, "Internal Processor")
busTypes.Add(13, "Internal Power Bus")
busTypes.Add(14, "PNP ISA Bus")
busTypes.Add(15, "PNP Bus")
busTypes.Add(16, "Maximum Interface Type")
Dim result As String = Nothing
Dim coll As ManagementObjectCollection = getManagementObjects("Win32_Bus")
Dim busType As Integer = -1
For Each mobj As ManagementObject in coll
If mobj.Properties("DeviceID").Value.ToString() = deviceBus Then
Integer.TryParse(mobj.Properties("BusType").Value.ToString(), busType)
Exit For
End If
Next
result = busTypes(busType)
Return result
End Function
Который производит этот результат на моей коробке:
ConfigMgr Remote Control Driver: PCI Bus
NVIDIA GeForce 8400 GS : PCI Bus
Winvnc video hook driver: PCI Bus
Привет! напиши: NVIDIA GeForce GT 610:. Шина PCI ** Но GT 610 PCI-E ** Я хочу, чтобы записать его на карту, которая является PCI-E или PCI-Express. – Zserigta
@ Zserigta - Я не знаю, есть ли способ получить то, что вы хотите. Вы можете попробовать посмотреть некоторые из других классов WMI, чтобы узнать, могут ли они предоставить эту информацию. http://msdn.microsoft.com/en-us/library/windows/desktop/aa394554(v=vs.85).aspx –