获取屏幕分辨率的VBS代码
程序员文章站
2022-08-27 18:20:35
我想到的方法有两种。 一种是wmi中的win32_desktopmonitor类 复制代码 代码如下: strcomputer = "." set objwmiservic...
我想到的方法有两种。
一种是wmi中的win32_desktopmonitor类
strcomputer = "."
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set colitems = objwmiservice.execquery("select * from win32_desktopmonitor",,48)
for each objitem in colitems
wscript.echo "screenheight: " & objitem.screenheight
wscript.echo "screenwidth: " & objitem.screenwidth
next
一种是html dom中的screen对象
dim ie
set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
set screen = ie.document.parentwindow.screen
wscript.echo "screenheight: " & screen.height
wscript.echo "screenwidth: " & screen.width
原文:http://demon.tw/programming/vbs-picture-resolution.html
一种是wmi中的win32_desktopmonitor类
复制代码 代码如下:
strcomputer = "."
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set colitems = objwmiservice.execquery("select * from win32_desktopmonitor",,48)
for each objitem in colitems
wscript.echo "screenheight: " & objitem.screenheight
wscript.echo "screenwidth: " & objitem.screenwidth
next
一种是html dom中的screen对象
复制代码 代码如下:
dim ie
set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
set screen = ie.document.parentwindow.screen
wscript.echo "screenheight: " & screen.height
wscript.echo "screenwidth: " & screen.width
参考链接
原文:http://demon.tw/programming/vbs-picture-resolution.html