此代码接收短信,并在我拥有的其他计算机上进行测试并完美运行。然后我重新创建了我拥有的系统。手动将其编码到另一台计算机。 “不要复制粘贴”。当我手动编码它时,显示错误“类”IDSMS.ManagementObject“无法编入索引,因为它没有默认属性”
Imports System.Management
Imports System.Threading
Public Class Receiving_SMS
Public WithEvents NewSMS As New mCore.SMS
Public Function connectmodem() As String
Dim modem As String
Try
Dim search As New ManagementObjectSearcher("root\CIMV2", "Select * from win32_POSTModem")
For Each queryobj As ManagementObject In search.Get()
If queryobj("Status") = "OK" Then
modem = modem & (queryobj("attached") & "- " & queryobj("Description") & "***")
End If
Next
Catch ex As ManagementException
MessageBox.Show(ex.Message)
Return ""
End Try
Return modem
End Function