Dim strTemp As String
Dim Send() As Byte
Dim data() As Byte
Dim length As Integer
strTemp = "aabbcc"
data = strTemp
length = UBound(data) + 1
If length > 256 Then
'
Else
ReDim Send(length + 6)
Send(0) = length
Send(1) = 1
Send(2) = 3
Send(3) = 1
Send(4) = 1
end if现在我要把data数组的内容加到Send数组里如何做?
Dim Send() As Byte
Dim data() As Byte
Dim length As Integer
strTemp = "aabbcc"
data = strTemp
length = UBound(data) + 1
If length > 256 Then
'
Else
ReDim Send(length + 6)
Send(0) = length
Send(1) = 1
Send(2) = 3
Send(3) = 1
Send(4) = 1
end if现在我要把data数组的内容加到Send数组里如何做?
是CSDN上的代码,忘记是谁的了.参考一下:Option ExplicitPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)Private Sub Command1_Click()
Dim mfile As String
mfile = "e:\zhou1.doc"
Dim buff() As Byte
Dim i As Long
i = FileLen(mfile)
ReDim buff(i - 1)
Open mfile For Binary As #1
Get #1, , buff
Close #1
'以上读出文件到数组buff
Dim s1 As String
Dim s2 As String
s1 = "hello"
s2 = "世界"
Dim buff1() As Byte
Dim buff2() As Byte
buff1 = StrConv(s1, vbFromUnicode)
buff2 = StrConv(s2, vbFromUnicode)
i = UBound(buff) + 1 + UBound(buff1) + 1 + UBound(buff2) + 1
Dim bytearr() As Byte
ReDim bytearr(i - 1)
Dim j As Long
CopyMemory bytearr(0), buff1(0), UBound(buff1) + 1
j = UBound(buff1) + 1
CopyMemory bytearr(j), buff(0), UBound(buff) + 1
j = j + UBound(buff) + 1
CopyMemory bytearr(j), buff2(0), UBound(buff2) + 1
End Sub