VB 16进制转换成 浮点数

来源:百度知道 编辑:UC知道 时间:2024/06/01 13:51:10
42 5A 07 1B 用软件转换得到浮点数是 54.5069 请问在VB里面 怎么实现?

Option Explicit
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

Private Sub Command1_Click()
Dim nBytes(0 To 3) As Byte
Dim fSingle As Single
nBytes(0) = 0
nBytes(1) = 120
nBytes(2) = 120
nBytes(3) = 66
CopyMemory fSingle, nBytes(0), 4
Debug.Print fSingle
End Sub