|
strTempFile = "C:\ScreenSize.txt"
Set oShell = CreateObject("wscript.shell")
oShell.Run "%comspec% /c wmic path win32_displayconfiguration get pelsheight, pelswidth>"& strTempFile , vbHide, True
Set FSO = CreateObject("scripting.filesystemobject")
Set FS = FSO.OpenTextFile(strTempFile, 1, False, -1)
FS.ReadLine
strString = FS.ReadLine
FS.Close
'Use regexp to get height and width
strReg = "(\d+)([^0-9]+)(\d+)"
Set reg = New RegExp
reg.IgnoreCase = True
reg.Pattern = strReg
intHeight = reg.Replace(strString, "$1")
intWidth = reg.Replace(strString, "$3") |
|