[已解决]如何检测显卡驱动是否安装?
本帖最后由 nxfhcsj 于 2011-7-16 18:02 编辑请教大家如何用au3检测显卡驱动是否安装? 用P大的SetupApi好像是可以的!不过我不懂,等大侠吧! ~嗯.谢谢 有大侠路过的没!! 我觉得可以通过注册表中的信息来分辨,具体没研究过,帮不了你、、、 读取注册表行不行?我猜的! __wmi_Win32_VideoController()
Func __wmi_Win32_VideoController()
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $colItems = ""
Local $strComputer = "localhost"
Local $Output=""
$Output &= "Computer: " & $strComputer& @CRLF
$Output &= "==========================================" & @CRLF
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
Local $strAcceleratorCapabilities = $objItem.AcceleratorCapabilities(0)
$Output &= "AcceleratorCapabilities: " & $strAcceleratorCapabilities & @CRLF
$Output &= "AdapterCompatibility: " & $objItem.AdapterCompatibility & @CRLF
$Output &= "AdapterDACType: " & $objItem.AdapterDACType & @CRLF
$Output &= "AdapterRAM: " & $objItem.AdapterRAM & @CRLF
$Output &= "Availability: " & $objItem.Availability & @CRLF
Local $strCapabilityDescriptions = $objItem.CapabilityDescriptions(0)
$Output &= "CapabilityDescriptions: " & $strCapabilityDescriptions & @CRLF
$Output &= "Caption: " & $objItem.Caption & @CRLF
$Output &= "ColorTableEntries: " & $objItem.ColorTableEntries & @CRLF
$Output &= "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
$Output &= "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
$Output &= "CreationClassName: " & $objItem.CreationClassName & @CRLF
$Output &= "CurrentBitsPerPixel: " & $objItem.CurrentBitsPerPixel & @CRLF
$Output &= "CurrentHorizontalResolution: " & $objItem.CurrentHorizontalResolution & @CRLF
$Output &= "CurrentNumberOfColors: " & $objItem.CurrentNumberOfColors & @CRLF
$Output &= "CurrentNumberOfColumns: " & $objItem.CurrentNumberOfColumns & @CRLF
$Output &= "CurrentNumberOfRows: " & $objItem.CurrentNumberOfRows & @CRLF
$Output &= "CurrentRefreshRate: " & $objItem.CurrentRefreshRate & @CRLF
$Output &= "CurrentScanMode: " & $objItem.CurrentScanMode & @CRLF
$Output &= "CurrentVerticalResolution: " & $objItem.CurrentVerticalResolution & @CRLF
$Output &= "Description: " & $objItem.Description & @CRLF
$Output &= "DeviceID: " & $objItem.DeviceID & @CRLF
$Output &= "DeviceSpecificPens: " & $objItem.DeviceSpecificPens & @CRLF
$Output &= "DitherType: " & $objItem.DitherType & @CRLF
$Output &= "DriverDate: " & WMIDateStringToDate($objItem.DriverDate) & @CRLF
$Output &= "DriverVersion: " & $objItem.DriverVersion & @CRLF
$Output &= "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
$Output &= "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
$Output &= "ICMIntent: " & $objItem.ICMIntent & @CRLF
$Output &= "ICMMethod: " & $objItem.ICMMethod & @CRLF
$Output &= "InfFilename: " & $objItem.InfFilename & @CRLF
$Output &= "InfSection: " & $objItem.InfSection & @CRLF
$Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
$Output &= "InstalledDisplayDrivers: " & $objItem.InstalledDisplayDrivers & @CRLF
$Output &= "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
$Output &= "MaxMemorySupported: " & $objItem.MaxMemorySupported & @CRLF
$Output &= "MaxNumberControlled: " & $objItem.MaxNumberControlled & @CRLF
$Output &= "MaxRefreshRate: " & $objItem.MaxRefreshRate & @CRLF
$Output &= "MinRefreshRate: " & $objItem.MinRefreshRate & @CRLF
$Output &= "Monochrome: " & $objItem.Monochrome & @CRLF
$Output &= "Name: " & $objItem.Name & @CRLF
$Output &= "NumberOfColorPlanes: " & $objItem.NumberOfColorPlanes & @CRLF
$Output &= "NumberOfVideoPages: " & $objItem.NumberOfVideoPages & @CRLF
$Output &= "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
Local $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
$Output &= "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
$Output &= "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
$Output &= "ProtocolSupported: " & $objItem.ProtocolSupported & @CRLF
$Output &= "ReservedSystemPaletteEntries: " & $objItem.ReservedSystemPaletteEntries & @CRLF
$Output &= "SpecificationVersion: " & $objItem.SpecificationVersion & @CRLF
$Output &= "Status: " & $objItem.Status & @CRLF
$Output &= "StatusInfo: " & $objItem.StatusInfo & @CRLF
$Output &= "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
$Output &= "SystemName: " & $objItem.SystemName & @CRLF
$Output &= "SystemPaletteEntries: " & $objItem.SystemPaletteEntries & @CRLF
$Output &= "TimeOfLastReset: " & WMIDateStringToDate($objItem.TimeOfLastReset) & @CRLF
$Output &= "VideoArchitecture: " & $objItem.VideoArchitecture & @CRLF
$Output &= "VideoMemoryType: " & $objItem.VideoMemoryType & @CRLF
$Output &= "VideoMode: " & $objItem.VideoMode & @CRLF
$Output &= "VideoModeDescription: " & $objItem.VideoModeDescription & @CRLF
$Output &= "VideoProcessor: " & $objItem.VideoProcessor & @CRLF
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI 输出","没有在类 " & "Win32_VideoController" & "中找到WMI对象" )
Endif
EndFunc
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc 回复 7# 3mile
谢谢大侠的指点,但是这个太复杂了.我只需要检测是否已经安装显卡驱动.并不需要这些详细的内容.当然这些也是有用的.只是我现在用不到.. 有没有更简单的检测代码呢.
我也尝试过注册表里面找.但是目前还没有找到十分有效的地方.. 回复 7# 3mile
谢谢大侠的指点,但是这个太复杂了.我只需要检测是否已经安装显卡驱动.并不需要这些详细的内容.当然这些也是有用的.只是我现在用不到.. 有没有更简单的检测代码呢.
我也尝试过注册表里面找.但是目前还没有找到十分有效的地方.. #include <SetupAPI.au3>
$aDisplay = _CM_Enum_Device_Info("Display")
For $i = 1 To $aDisplay
$iStatus = _CM_Get_DevNode_Status($aDisplay[$i])
If BitAND($iStatus, $DN_HAS_PROBLEM) Or (0 = BitAND($iStatus, $DN_DRIVER_LOADED)) Then
MsgBox(48, $aDisplay[$i], "'" & $aDisplay[$i] & "' has some problems.")
EndIf
Next
页:
[1]