I tried to use Windows Scripting Host to provide me information about the monitors, but it seems it doesn't work as expected. For me it simply didn't give information about all the displays that I had active (external "Generic Television" + laptop "Standard Display"), instead I always only got information on the display that was active when I first started ("Generic Television").
So here is the code for those who want to check it out, it is short'n'sweet:Code:Option Explicit ' http://msdn.microsoft.com/en-us/library/aa394122(VS.85).aspx Public Function Monitors() As Object ' get scripting object and make a call to scripting host to get the monitors Set Monitors = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_DesktopMonitor") End Function Private Sub Command1_Click() Dim objMonitor As Object ' this loop makes a single call to Monitors function to receive information about the monitors For Each objMonitor In Monitors ' display information in a message box MsgBox "Resolution: " & objMonitor.ScreenWidth & " x " & objMonitor.ScreenHeight & vbNewLine & objMonitor.Availability, vbInformation, objMonitor.Description Next objMonitor End Sub




Reply With Quote