获取物理显卡数量
本帖最后由 q113960096 于 2014-10-26 21:54 编辑现在很多笔记本电脑有双显卡,希望能够判断电脑物理显卡的数量,无从下手,有知道的还望提点一二谢谢!对了,要在PE环境下进行识别!!
#include <SetupApi.au3>
#include <array.au3>
Local $aryInfo
Local $aryDisplay
Local $aryNetwork
Local $aryChipset
Local $aryAudio
$aryDisplay = 0
$aryNetwork = 0
$aryChipset = 0
$aryAudio = 0
FindDeviceRecur(_CM_Locate_DevNode(""))
; This is what you want.
_ArrayDisplay($aryDisplay)
Func FindDeviceRecur($hDevInst)
$aChild = _CM_Enumerate_Children($hDevInst)
For $i = 1 To $aChild
$hDevInst = _CM_Locate_DevNode($aChild[$i])
$Class = _CM_Get_DevNode_Registry_Property($hDevInst, $CM_DRP_CLASS)
$sDescr = _CM_Get_DevNode_Registry_Property($hDevInst, 1)
$Version = Get_Driver_Version($hDevInst)
_2ArrayAdd($aryInfo, $Class & "|" & $sDescr)
If $Class = "Display" Then
;MsgBox(0,"","显卡型号:" & $sDescr & @CRLF & @CRLF & "驱动版本:" & $Version)
_2ArrayAdd($aryDisplay,$sDescr & "|" & $Version)
EndIf
If $Class = "Net" Then
;MsgBox(0,""," 网卡型号:" & $sDescr & @CRLF & @CRLF & "驱动版本:" & $Version)
_2ArrayAdd($aryNetwork,$sDescr & "|" & $Version)
EndIf
If $Class = "Processor" Then
;MsgBox(0,"","处理器:" & $sDescr & @CRLF & @CRLF & "驱动版本:" & $Version)
_2ArrayAdd($aryChipset,$sDescr & "|" & $Version)
EndIf
If $Class = "Media" Then
;MsgBox(0,"","声卡" & $sDescr & @CRLF & @CRLF & "驱动版本:" & $Version)
_2ArrayAdd($aryAudio,$sDescr & "|" & $Version)
EndIf
;此处只是为了取显卡的信息,所以加了判断,去掉可以取所有硬件驱动版本信息
FindDeviceRecur($hDevInst)
Next
EndFunc
Func _2ArrayAdd(ByRef $ary, $Data)
Local $iLength = UBound($ary) + 1
Local $DataList = StringSplit($Data, "|")
If IsArray($DataList) Then
ReDim $ary[$iLength]
$ary[$iLength - 1] = $DataList
$ary[$iLength - 1] = $DataList
EndIf
Return $ary
EndFunc
Func Get_Driver_Version($hDevInst)
$ClassGUID = _CM_Get_DevNode_Registry_Property($hDevInst, 10)
If $ClassGUID = "" Then Return "Unknown"
If @OSArch = "X86" Then
$Reg = "HKLM\SYSTEM\ControlSet001\Control\Class\"
Else
$Reg = "HKLM64\SYSTEM\ControlSet001\Control\Class\"
EndIf
$Version = RegRead($Reg & $ClassGUID, "DriverVersion")
If $Version = "" Then
Return "Unknown"
Else
Return $Version
EndIf
EndFunc
回复 2# MicroBlue
把SetupApi.au3 交出来 {:1_270:} 回复 3# yinbinly
你搜论坛,一堆 setupapi.au3。你要是找不到,我再给你。
页:
[1]