Jump to content

How To *get* The Current Video Resolution


Recommended Posts

Is there a way to find out what the current video resolution is in Windows? I'm running a script that needs to know that the current resolution is. In the workstation, I found a regkey that changes values when the resolution changes, but this is missing on another machine. So, it seems that the value is machine specific and quite possibly installation specific.

So, how do we do it?

Link to comment
Share on other sites


This is a simple vbs script which echoes the height and width

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = "localhost"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "ScreenHeight: " & objItem.ScreenHeight
WScript.Echo "ScreenWidth: " & objItem.ScreenWidth
Next

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...