Bonjour,
Ce n'est pas vraiment une demande d'aide mais plutôt une demande de test, je me torture l'esprit pour trouver les noms d'écrans en fonction du device number.
J'en suis arrivé au code ci dessous, et j'aimerai que vous le testiez et me disiez si vous trouvez tous le/les bons noms d'écrans.
Résultats de la forme :
Écran n°1 : XXXX | XXXX
Écran n°2 : YYYY | YYYY
etc
(deux fois les mêmes valeurs par ligne, si vous n'en avez qu'une ou 0 merci de me l'indiquer)
Pour connaitre le nom de son écran :
Win XP : Il n'affiche pas le vrai nom, je n'ai donc pas besoin de tests sous XP
Win 7/8 : Clic droit / Résolution d'écran
Le plus simple est de lancer le script, faire Ctrl + c dans la MsgBox et de le coller ici
► Afficher le textecode
Code : Tout sélectionner
#include <WinAPI.au3>
Local $txt
For $i = 0 To _MonitorGetCount()-1
$txt &= "Écran n°" & $i+1 & " : " & _MonitorGetName($i) & " | " & _MonitorGetName(_MonitorGetIdByNumber($i)) & @LF
Next
MsgBox(0, "", $txt)
Func _MonitorGetCount()
Local $count = 0
While(True)
Local $displayDevice = _WinAPI_EnumDisplayDevices("", $count)
If(Not(IsArray($displayDevice)) Or BitAND($displayDevice[3], 1) = 0) Then ExitLoop
$count += 1
WEnd
Return $count
EndFunc
Func _MonitorGetName($pathId)
Local $name = ""
If(StringIsDigit($pathId)) Then $pathId = _MonitorGetIdByNumber($pathId)
If(Not(StringInStr($pathId, "?"))) Then $pathId = _MonitorGetIdByDisplayName($pathId)
If(StringLen($pathId) > 0) Then
Local $regId = StringSplit($pathId, "\", 3)
$regId = StringReplace($regId[UBound($regId, 1)-1], "#", "\")
$regId = StringSplit($regId, "{", 3)[0]
$name = _MonitorGetNameByRegId($regId)
EndIf
Return $name
EndFunc
Func _MonitorGetIdByDisplayName($displayName)
Local $retour = ""
Local $displayDevice = _WinAPI_EnumDisplayDevices($displayName, 0)
If(IsArray($displayDevice)) Then
$retour = $displayDevice[4]
EndIf
Return $retour
EndFunc
Func _MonitorGetIdByNumber($number)
Local $retour = ""
Local $displayDevice = _WinAPI_EnumDisplayDevices("", $number)
If(IsArray($displayDevice)) Then
$retour = _MonitorGetIdByDisplayName($displayDevice[1])
EndIf
Return $retour
EndFunc
Func _MonitorGetNameByRegId($regId)
Local $retour = ""
Local $edid = RegRead("HKLM64\SYSTEM\CurrentControlSet\Enum\" & $regId & "\Device Parameters", "EDID")
$edid = StringSplit($edid, "000000FC00", 3)
If(UBound($edid, 1) > 1) Then
$edid = StringSplit($edid[1], "0A", 3)[0]
$retour = BinaryToString("0x" & $edid)
EndIf
Return $retour
EndFunc
Merci par avance.
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679