- Offizieller Beitrag
Der Hinweis auf den Reg_Binary-Key "VolatileSettings" hat mich entscheidend weiter gebracht. Jetzt habe ich die Funktion für Win7 fertig.
Es werden immer Einträge aus RegKeys benutzt, kein "raten" mehr.
So weit erstmal die Win7-Monitor-Erkennung:
Spoiler anzeigen
#include <Array.au3>
$aMonitor = _CI_GetMonitor()
_ArrayDisplay($aMonitor)
Func _CI_GetMonitor()
Local $iCount = 0, $sHKLM, $sDeviceVideo, $iMaxObjectNumber, $sVideo, $sTmp, $sUnitedVideo, $sMfg, $sDeviceDesc, $sDPMS, $sDriver, $x, $y, $xRes, $yRes, $sMaxRes
Local $aMonitor[$iCount + 1][6] = [['Hersteller:', 'Modell:', 'DPMS-Untersützung:', 'Position (x, y):', 'akt. Auflösung:', 'max. Auflösung:']]
$sHKLM = 'HKEY_LOCAL_MACHINE'
If @OSArch <> 'X86' Then $sHKLM &= '64'
Switch @OSVersion
Case 'WIN_VISTA', 'WIN_7'
$sDeviceVideo = $sHKLM & '\HARDWARE\DEVICEMAP\VIDEO'
$iMaxObjectNumber = Number(String(RegRead($sDeviceVideo, 'MaxObjectNumber')))
If $iMaxObjectNumber > 0 Then
For $i = 0 To $iMaxObjectNumber
$sVideo = StringReplace(RegRead($sDeviceVideo, '\Device\Video' & $i), '\Registry\Machine', $sHKLM)
$sTmp = String(RegEnumVal($sVideo & '\VolatileSettings', 1))
If $sTmp <> '' Then
$sUnitedVideo = StringReplace($sVideo, '\Control', '\Hardware Profiles\UnitedVideo\Control')
$x = Number(String(RegRead($sUnitedVideo, 'Attach.RelativeX')))
If $x > 2 ^ 31 Then $x = -BitXOR($x, 0xffffffff)
$y = Number(String(RegRead($sUnitedVideo, 'Attach.RelativeY')))
If $y > 2 ^ 31 Then $y = -BitXOR($y, 0xffffffff)
$xRes = Number(String(RegRead($sUnitedVideo, 'DefaultSettings.XResolution')))
$yRes = Number(String(RegRead($sUnitedVideo, 'DefaultSettings.YResolution')))
$sMonitor = RegRead($sHKLM & '\SYSTEM\CurrentControlSet\services\monitor\Enum', $iCount)
$sMfg = RegRead($sHKLM & '\SYSTEM\CurrentControlSet\Enum\' & $sMonitor, 'Mfg')
$sMfg = StringRegExpReplace($sMfg, '.+;(.+)', '$1')
$sDeviceDesc = RegRead($sHKLM & '\SYSTEM\CurrentControlSet\Enum\' & $sMonitor, 'DeviceDesc')
$sDeviceDesc = StringRegExpReplace($sDeviceDesc, '.+;(.+)', '$1')
$sDPMS = Number(String(RegRead($sHKLM & '\SYSTEM\CurrentControlSet\Enum\' & $sMonitor & '\Device Parameters', 'DPMS')))
$sDriver = RegRead($sHKLM & '\SYSTEM\CurrentControlSet\Enum\' & $sMonitor, 'Driver')
$sMaxRes = String(RegRead($sHKLM & '\SYSTEM\CurrentControlSet\Control\Class\' & $sDriver, 'MaxResolution'))
$sMaxRes = StringReplace($sMaxRes, ',', ' x ')
$iCount += 1
ReDim $aMonitor[$iCount + 1][6]
$aMonitor[$iCount][0] = $sMfg
$aMonitor[$iCount][1] = $sDeviceDesc
$aMonitor[$iCount][2] = StringMid('NeinJa', $sDPMS * 4 + 1, 4)
$aMonitor[$iCount][3] = $x & ', ' & $y
$aMonitor[$iCount][4] = $xRes & ' x ' & $yRes
$aMonitor[$iCount][5] = $sMaxRes
EndIf
Next
Return $aMonitor
EndIf
Case Else
MsgBox(0,0, 'OS wird z.Zt. nicht unterstützt.')
EndSwitch
EndFunc ;==>_CI_GetMonitor
Nach Weihnachten mache ich mich an die Funktion für den Rest. Danke, Bitboy, für den Hinweis.
User mit Win7 könnten die Funktion mal testen. Normalerweise müsste es jetzt passen...