找回密码
 加入
搜索
查看: 4337|回复: 9

[系统综合] [已解决]如何检测显卡驱动是否安装?

  [复制链接]
发表于 2011-7-12 22:37:21 | 显示全部楼层 |阅读模式
本帖最后由 nxfhcsj 于 2011-7-16 18:02 编辑

请教大家如何用au3检测显卡驱动是否安装?
发表于 2011-7-12 22:58:49 | 显示全部楼层
用P大的SetupApi好像是可以的!不过我不懂,等大侠吧!
 楼主| 发表于 2011-7-12 23:48:02 | 显示全部楼层
~  嗯.谢谢
 楼主| 发表于 2011-7-13 14:29:45 | 显示全部楼层
有大侠路过的没!!
发表于 2011-7-13 19:07:22 | 显示全部楼层
我觉得可以通过注册表中的信息来分辨,具体没研究过,帮不了你、、、
发表于 2011-7-13 22:10:43 | 显示全部楼层
读取注册表行不行?我猜的!
发表于 2011-7-13 22:48:27 | 显示全部楼层
__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
 楼主| 发表于 2011-7-14 19:34:10 | 显示全部楼层
回复 7# 3mile

谢谢大侠的指点,但是这个太复杂了.我只需要检测是否已经安装显卡驱动.并不需要这些详细的内容.当然这些也是有用的.只是我现在用不到..    有没有更简单的检测代码呢.
     我也尝试过注册表里面找.但是目前还没有找到十分有效的地方..
 楼主| 发表于 2011-7-14 19:38:54 | 显示全部楼层
回复 7# 3mile

谢谢大侠的指点,但是这个太复杂了.我只需要检测是否已经安装显卡驱动.并不需要这些详细的内容.当然这些也是有用的.只是我现在用不到..    有没有更简单的检测代码呢.
     我也尝试过注册表里面找.但是目前还没有找到十分有效的地方..
发表于 2011-7-14 19:46:23 | 显示全部楼层
#include <SetupAPI.au3>

$aDisplay = _CM_Enum_Device_Info("Display")

For $i = 1 To $aDisplay[0][0]
        $iStatus = _CM_Get_DevNode_Status($aDisplay[$i][2])
        If BitAND($iStatus, $DN_HAS_PROBLEM) Or (0 = BitAND($iStatus, $DN_DRIVER_LOADED)) Then
                MsgBox(48, $aDisplay[$i][0], "'" & $aDisplay[$i][0] & "' has some problems.")
        EndIf
Next
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-17 07:22 , Processed in 0.075731 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表