📄 main.bas
字号:
Attribute VB_Name = "Main"
Option Explicit
'0 for Char, 1 for Hex
Public nDisplayMode As Integer
Public Const MODE_CHAR = 0
Public Const MODE_HEX = 1
Public bSoundMark As Boolean
Public bGateWay As Boolean
Public bCapture As Boolean
Public Const nMaxProtocolBytes = 127 'in database
' commTimerStartMark1 can be used as COM ReadBusy,
' at this time, you cannot write COM!
Public commTimerStartMark1 As Boolean '1 for master, 2 for slave.
Public commTimerStartMark2 As Boolean
Public nMaxReceiveChars1 As Long 'used to the commTimer
Public nMaxReceiveChars2 As Long
Public strRecHex1 As String 'received hex chars
Public strRecHex2 As String
Public nBlockParity1 As Integer '0=none, 1=xor, 2=add, 3=crc, 4=checksum
Public nBlockParity2 As Integer
Public nEndMark1 As Integer '0=none, 1=cr, 2=crlf
Public nEndMark2 As Integer
Public ResultString As String 'Display in the MultiTextBox
Public strDataPath As String
Public strSoundPath As String
Public Sub RestoreComData(nSort As Integer, objComm As MSComm)
Dim CommPort As String
Dim Handshaking As String
Dim Settings As String
Dim strTmp As String
If nSort > 2 Or nSort < 1 Then
MsgBox "Wrong port number!", vbCritical + vbOKOnly
Exit Sub
End If
strTmp = "Properties" + Trim(Str(nSort))
Settings = GetSetting(App.Title, strTmp, "Settings", "")
If Settings <> "" Then
objComm.Settings = Settings
If Err Then
MsgBox Error$, vbExclamation + vbOKOnly
Exit Sub
End If
End If
CommPort = GetSetting(App.Title, strTmp, "CommPort", "")
If CommPort <> "" Then objComm.CommPort = Val(CommPort)
Handshaking = GetSetting(App.Title, strTmp, "Handshaking", "")
If Handshaking <> "" Then
objComm.Handshaking = Handshaking
If Err Then
MsgBox Error$, vbExclamation + vbOKOnly
Exit Sub
End If
End If
If nSort = 1 Then
nBlockParity1 = Val(GetSetting(App.Title, strTmp, "BlockParity", ""))
nEndMark1 = Val(GetSetting(App.Title, strTmp, "EndMark", ""))
nMaxReceiveChars1 = Val(GetSetting(App.Title, strTmp, "MaxChars", ""))
If nMaxReceiveChars1 = 0 Then nMaxReceiveChars1 = 10
Else
nBlockParity2 = Val(GetSetting(App.Title, strTmp, "BlockParity", ""))
nEndMark2 = Val(GetSetting(App.Title, strTmp, "EndMark", ""))
nMaxReceiveChars2 = Val(GetSetting(App.Title, strTmp, "MaxChars", ""))
If nMaxReceiveChars2 = 0 Then nMaxReceiveChars2 = 10
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -