7,785
社区成员




Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim i As Long
Private Sub Command1_Click()
Dim hexData As String
Dim a As Single
Dim Buffer(3) As Byte
a = 100
CopyMemory Buffer(0), a, 4
For i = 0 To 3
If Len(Hex(Buffer(i))) = 1 Then
hexData = "0" & Hex(Buffer(i)) + hexData
Else
hexData = Hex(Buffer(i)) + hexData
End If
Next
Debug.Print hexData
End Sub
Dim s as String
s="100"
Debug.Print "42c800" & Right(s,2)