1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
'tp indique si c'est une réception ou une émission.
Public Sub AddText(ByVal tp As Integer, ByVal Message As String)
Dim m As String
Dim i As Integer
If Not enStop Then
RichTextBox1.SelColor = ColorConstants.vbBlack
RichTextBox1.SelText = "[" & TimeToMillisecond & "] : "
RichTextBox1.SelBold = False
RichTextBox1.SelItalic = False
For i = 1 To Len(Message)
m = Mid(txt, i, 1)
If InStr(1, m, Chr(22)) > 0 Then
If optHex.value Then m = Replace(m, Chr(22), "(16)")
If optChar.value Then m = Replace(m, Chr(22), "(SYN)")
RichTextBox1.SelColor = &HC000& 'ColorConstants.vbCyan
ElseIf InStr(1, m, Chr(13)) > 0 Then
If optHex.value Then m = Replace(m, Chr(13), "(0D)")
If optChar.value Then m = Replace(m, Chr(13), "(CR)")
RichTextBox1.SelColor = &H8000& 'ColorConstants.vbCyan
ElseIf InStr(1, m, Chr(10)) > 0 Then
If optHex.value Then m = Replace(m, Chr(10), "(0A)")
If optChar.value Then m = Replace(m, Chr(10), "(LF)")
RichTextBox1.SelColor = &H4000& 'ColorConstants.vbCyan
ElseIf InStr(1, m, Chr(6)) > 0 Then
If optHex.value Then m = Replace(m, Chr(6), "(06)")
If optChar.value Then m = Replace(m, Chr(6), "(ACK)")
RichTextBox1.SelColor = &H80FF& 'ColorConstants.vbCyan
Else
If tp = 1 Then RichTextBox1.SelColor = ColorConstants.vbBlue
If tp = 2 Then RichTextBox1.SelColor = ColorConstants.vbRed
End If
RichTextBox1.SelText = m
Next i
RichTextBox1.SelText = vbCrLf
End If
End Sub |
Partager