你先将这个字节数组转换成字符串吧
Public Function ByteArrToHexStr(bArr() As Byte, Optional nStartPos As Long = 0, Optional nLen As Long = 0) As String
Dim bArrTmp() As Byte
Dim nLength As Long
Dim i As Long
Dim tmp As String
On Error GoTo errHdl
ByteArrToHexStr = ""
nLength = nLen
If nLen <= 0 Then nLength = UBound(bArr) - LBound(bArr) + 1
ReDim bArrTmp(nLength - 1)
CopyMemory bArrTmp(0), bArr(nStartPos), nLength
For i = 0 To nLength - 1
tmp = Format(Hex(bArrTmp(i)), "00")
If Len(tmp) = 1 Then tmp = "0" & tmp
ByteArrToHexStr = ByteArrToHexStr & tmp 'Format(Hex(bArrTmp(i)), "00")
Next
Exit Function
errHdl:
ByteArrToHexStr = ""
End Function
然后再去分析
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As Any, Source As Any, ByVal Length As Long)
Sub SwapPtr(sA As String, sB As String)
Dim lTmp As Long
CopyMemory lTmp, ByVal VarPtr(sA), 4
CopyMemory ByVal VarPtr(sA), ByVal VarPtr(sB), 4
CopyMemory ByVal VarPtr(sB), lTmp, 4
End Sub