WMI Fun !! 〜 WMI に興味がある方・システム管理者必見! 〜 |
|
![]() |
WMI Fun !! > WMI Sample (VB) > モニタを取得する |
モニタを取得する: Win32_DesktopMonitor - WMI Sample (VB)Topics
接続されているモニタの情報を取得するサンプルプログラムです。
Sample Code
Private Sub Command1_Click()
Dim MonSet As SWbemObjectSet Dim Mon As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim MesStr As String Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer Set MonSet = Service.ExecQuery("Select * From Win32_DesktopMonitor") For Each Mon In MonSet MesStr = MesStr & "モニタ名: " & Mon.Name & vbCrLf & _ "解像度: " & Mon.ScreenWidth & "x" & Mon.ScreenHeight & vbCrLf & vbCrLf Next MsgBox "接続されているモニタの一覧です。" & vbCrLf & vbCrLf & _ MesStr & "ですよ。" Set MonSet = Nothing Set Mon = Nothing Set Service = Nothing Set Locator = Nothing End Sub
![]() Comment
実行すると現在接続されているモニタの名前と解像度を表示します。 ![]() Recommended book
個人的にお勧めする本の紹介です。 ![]() |
ご意見・ご要望・ご感想をこちらのアンケートからお待ちしています |
∧ ページの先頭へ… |