以友好名称显示串口,可能在win 8.1 x64上工作,并且使用vb.net正在使用win 7 x32

时间:2016-07-21 03:47:57

标签: vb.net windows-7 serial-port windows-8.1

当我尝试通过友好名称在Win 7 x32上显示我的串行端口时,无论是物理还是虚拟,它都能正常工作,但是当我在Win 8.1 x64上尝试它时,只显示虚拟端口。当我删除虚拟它没有显示任何错误实际上它只是加载表单。

Try
     'Dim searcher As New ManagementObjectSearcher("root\cimv2", "SELECT * FROM Win32_SerialPort where Description='Prolific USB-to-Serial Comm Port'")
      Dim searcher As New ManagementObjectSearcher("root\cimv2", "SELECT * FROM Win32_SerialPort ")
      For Each queryObj As ManagementObject In searcher.Get()
          RichTextBox1.Text &= queryObj("Name") & Chr(32) & queryObj("DeviceID") & vbCr
      Next

Catch err As ManagementException
      MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try

几乎忘了我试图检测USB到RS-232但没有运气。

0 个答案:

没有答案