16,554
社区成员
发帖
与我相关
我的任务
分享
Dim ports as String() = System.IO.Ports.SerialPort.GetPortNames()
' SerialPort.PortName = portName(i)
' SerialPort.Open()
' SerialPort.Close()
'----wince中不支持此做法-卡-而XP下可以用来找可用串口--BAK--为保证通用性暂时屏蔽这样了
'****************************************************
'判断注册表中是否已经选择中扫描终端类型过,如果选择正确,则下次可以不用选择。
'****************************************************
Dim sRegScanType As String
Dim hklm As RegistryKey = Registry.LocalMachine
Dim subkey As RegistryKey
subkey = hklm.OpenSubKey("STScan", False)
If subkey Is Nothing Then
sRegScanType = ""
Else
sRegScanType = subkey.GetValue("Type").ToString
End If
If Not subkey Is Nothing Then
subkey.Close()
subkey = Nothing
End If
If Not hklm Is Nothing Then
hklm.Close()
hklm = Nothing
End If