获取系统显示设备的信息
#Include <WinAPI.au3>
_WinAPI_EnumDisplayDevices($sDevice, $iDevNum)
$sDevice | 设备名称.如果为空.函数根据 $iDevNum 返回本机显卡信息. |
$iDevNum | 基于0开始的索引值,指定显示设备信息. |
成功: | 返回数组的格式如下: |
$aDevice[0] - True | |
$aDevice[1] - 任何适配器设备或监控装置 | |
$aDevice[2] - 任何适配器或监视器的描述 | |
$aDevice[3] - 设备状态标志: | |
1 - 设备是桌面的一部分 | |
2 - 设备是主桌面 | |
4 - 映射远程应用绘图的伪设备 | |
8 - 设备为 VGA 兼容 | |
16 - 可移动设备;不能作为主显示 | |
32 - 与支持的输出设备相比,有更多的显示模式 | |
$aDevice[4] - 保留使用 | |
失败: | 设置 @error |
在MSDN中搜索
#include <WinAPI.au3>
_Main()
Func _Main()
Local $aDevice, $i = 0, $text
While 1
$aDevice = _WinAPI_EnumDisplayDevices("", $i)
If Not $aDevice[0] Then ExitLoop
$text = "Successful? " & $aDevice[0] & @LF
$text &= "Device (Adapter or Monitor): " & $aDevice[1] & @LF
$text &= "Description (Adapter or Monitor): " & $aDevice[2] & @LF
$text &= "Device State Flag: " & $aDevice[3] & @LF
If BitAND($aDevice[3], 32) Then $text &= @TAB & "- The device has more display modes than its output devices support" & @LF
If BitAND($aDevice[3], 16) Then $text &= @TAB & "- The device is removable; it cannot be the primary display" & @LF
If BitAND($aDevice[3], 8) Then $text &= @TAB & "- The device is VGA compatible" & @LF
If BitAND($aDevice[3], 4) Then $text &= @TAB & "- Represents a pseudo device used to mirror application drawing for remoting" & @LF
If BitAND($aDevice[3], 2) Then $text &= @TAB & "- The primary desktop is on the device" & @LF
If BitAND($aDevice[3], 1) Then $text &= @TAB & "- The device is part of the desktop" & @LF
$text &= "Plug and Play identifier string: " & $aDevice[4] & @LF
MsgBox(0, "", $text)
$i += 1
WEnd
EndFunc ;==>_Main