Private Type abc
    a       As Integer
    b()       As byte
    c       As Integer
End Type

解决方案 »

  1.   

    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim Str As String
    Dim RecByte() As Byte
    Dim i As Integer, j As Integer
    Dim temp As String
    Dim Res As Single
    Winsock1.GetData RecByte, vbByteFor i = 0 To UBound(RecByte)
        If RecByte(i) > 127 Then
            temp = Hex(RecByte(i))
            i = i + 1
            temp = temp + Hex(RecByte(i))
            Res = 0
            For j = 1 To Len(temp)
                Select Case Mid(temp, j, 1)
                Case "A"
                    Res = Res * 16 + 10
                Case "B"
                    Res = Res * 16 + 11
                Case "C"
                    Res = Res * 16 + 12
                Case "D"
                    Res = Res * 16 + 13
                Case "E"
                    Res = Res * 16 + 14
                Case "F"
                    Res = Res * 16 + 15
                Case Else
                    Res = Res * 16 + Val(Mid(temp, j, 1))
                End Select
            Next j
            Str = Str + Chr(Res)
        Else
            Str = Str + Chr(RecByte(i))
        End If
    Next i
    Text1.Text = Str
    End Sub