Dim b1() As Byte
Dim b2() As Byte
Dim b() As Byteb1=......
b2=......b = b1 & b2  ???

解决方案 »

  1.   

    Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)CopyMemory b, b1, UBound(b1) + 1
    CopyMemory b(UBound(b1) + 1), b2, UBound(b2) + 1
      

  2.   

    不好意思,上面错了一点,重发
    Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)CopyMemory b(0), b1(0), UBound(b1) + 1
    CopyMemory b(UBound(b1) + 1), b2(0), UBound(b2) + 1
      

  3.   

    Option ExplicitPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
                            Destination As Any, _
                            Source As Any, _
                            ByVal Length As Long)
                            
                            
    Public Function ArrayLink(ByRef a1() As Byte, _
                              ByRef a2() As Byte, _
                              ByRef r() As Byte) As Boolean
    On Error GoTo REERR
        ArrayLink = True
        Dim lLength1 As Long, lLength2 As Long, lLength3 As Long
        Dim pWritePoint As Long
        pWritePoint = 0
        lLength1 = UBound(a1) + 1
        lLength2 = UBound(a2) + 1
        lLength3 = lLength1 + lLength2
        ReDim r(lLength3 - 1)
        CopyMemory r(pWritePoint), a1(0), lLength1
        pWritePoint = lLength1
        CopyMemory r(pWritePoint), a2(0), lLength2
        Exit Function
    REERR:
        ArrayLink = False
    End FunctionPublic Function ArrayInsert(ByRef a1() As Byte, _
                                ByRef a2() As Byte, _
                                ByRef r() As Byte, _
                                ByVal lStart As Long) As Boolean
    On Error GoTo REERR
        ArrayInsert = True
        Dim lLength1 As Long, lLength2 As Long, lLength3 As Long
        Dim pWritePoint As Long
        pWritePoint = 0
        lLength1 = UBound(a1) + 1
        lLength2 = UBound(a2) + 1
        lLength3 = lLength1 + lLength2
        If lStart > lLength1 Then GoTo REERR
        ReDim r(lLength3 - 1)
        CopyMemory r(pWritePoint), a1(0), lStart
        pWritePoint = lStart
        CopyMemory r(pWritePoint), a2(0), lLength2
        pWritePoint = pWritePoint + lLength2
        CopyMemory r(pWritePoint), a1(lStart), lLength1 - lStart
        Exit Function
    REERR:
        ArrayInsert = False
    End FunctionPublic Function ArrayReplace(ByRef a1() As Byte, _
                                 ByRef a2() As Byte, _
                                 ByRef r() As Byte, _
                                 ByVal lStart As Long, _
                                 ByVal lLength As Long) As Boolean
    On Error GoTo REERR
        ArrayReplace = True
        Dim lLength1 As Long, lLength2 As Long, lLength3 As Long
        Dim pWritePoint As Long
        pWritePoint = 0
        lLength1 = UBound(a1) + 1
        lLength2 = UBound(a2) + 1
        lLength3 = lLength1 + lLength2 - lLength
        If lStart + lLength > lLength1 Then GoTo REERR
        ReDim r(lLength3 - 1)
        CopyMemory r(pWritePoint), a1(0), lStart
        pWritePoint = lStart
        CopyMemory r(pWritePoint), a2(0), lLength2
        pWritePoint = pWritePoint + lLength2
        CopyMemory r(pWritePoint), a1(lStart + lLength), lLength1 - lStart - lLength
        Exit Function
    REERR:
        ArrayReplace = False
    End FunctionPublic Function ArrayCopy(ByRef aDestination() As Byte, _
                            ByRef aSource() As Byte, _
                            Optional ByVal lStart As Long = -1, _
                            Optional ByVal lLength As Long = -1) As Boolean
    On Error GoTo REERR
        ArrayCopy = True
        If lStart = -1 Then lStart = 0
        If lLength = -1 Then lLength = UBound(aSource) + 1
        If lStart + lLength > UBound(aSource) + 1 Then GoTo REERR
        ReDim aDestination(lLength - 1)
        CopyMemory aDestination(0), aSource(lStart), lLength
        Exit Function
    REERR:
        ArrayCopy = False
    End Function
      

  4.   

    Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)CopyMemory b(0), b1, len(b1)
    CopyMemory b(UBound(b1) + 1), b2, len(b2)