Bonjour,
Je cherche à récupérer à minima le nombre de Moniteurs Actifs sur un pc via WMI. l’idéal serait d'obtenir les modèles et les marques.

J'ai essayé avec le code ci-dessous, mais il ne m'affiche que les infos de l'écran qui est connecté au PORT VGA, et rien concernant celui en DISPLAYPORT !?

je suis sous W7 64bits

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Sub WMI_Ecrans_resolution()
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set colEcrans = objWMIService.ExecQuery _
    ("Select * from Win32_DesktopMonitor")
report = report & "******************************************" & vbCrLf
report = report & "Écran(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objEcran In colEcrans
        report = report & "- Nom de l'écran: " & objEcran.Name & vbCrLf
        report = report & "- Type d'écran: " & objEcran.MonitorType & vbCrLf
        report = report & "- Nom du fabricant: " & objEcran.MonitorManufacturer & vbCrLf
        report = report & "- Hauteur: " & objEcran.ScreenHeight & vbCrLf
        report = report & "- Largeur: " & objEcran.ScreenWidth & vbCrLf
        report = report & vbCrLf
        'Debug.Print report
Next
Set colCartesVideo = objWMIService.ExecQuery _
    ("Select Description From Win32_VideoController")
report = report & "******************************************" & vbCrLf
report = report & "Carte(s) vidéo" & vbCrLf & "******************************************" & vbCrLf
For Each objCarteVideo In colCartesVideo
        report = report & "- Nom de la carte: " & objCarteVideo.Description & vbCrLf
        report = report & vbCrLf
 
Next
Debug.Print report
End Sub