화면 해상도를 위한 VBS 코드 가져오기

1084 단어
내가 생각한 방법은 두 가지가 있다.
하나는 WMI의 Win32.Desktop Monitor 클래스
 
  
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
    
  • Win32_DesktopMonitor Class
  • screen Object

  • 텍스트:http://demon.tw/programming/vbs-picture-resolution.html

    좋은 웹페이지 즐겨찾기