http://www.ncis.com.tw/ncis_bbs/redirect.php?tid=893&goto=lastpost

Option Explicit

Private Sub Command1_Click()
  Dim obj As Object
  Dim items As Object
  Dim item As Object

  Set obj = GetObject( _
            "winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

  Set items = obj.ExecQuery("Select * from Win32_SerialPort")

  For Each item In items
     Print "COMPORT: " & item.DeviceID
  Next
End Sub

創作者介紹

A little IT experience/study/share garden

cbw0731 發表在 痞客邦 PIXNET 留言(0) 人氣()