14455.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>A sample for byte data convert .</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>A sample for byte data convert .</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by 安宝 on June 21, 1999 at 16:21:51:<p>
In Reply to: <a href="14387.html">Receive Byte array to change Decimal</a> posted by 王廉 on June 17, 1999 at 19:55:18:<p>
For general conditions :<br>1. 2 bytes integer (Word) :<br>    iValue  = &H00 * DataByte(0) + DataByte(1)<br>2. 4 bytes integer (Long) :<br>    iValue  = &H000000 * DataByte(0) + &H0000 * DataByte(1) + &H00 * DataByte(2) +DataByte(3)<br>3. 4 bytes single (Real) or 4 bytes double (float) ???<p>Some machines have limited that you have to change the high - low bytes data . Here you need to try it .<p>May be you can use another method (We have tried it already ) :<p>' Here I will show you a sample for single data transferring . If <br>' you need , you can change the data type by yourself.<p>Public type iBuff<br>  bFloat as  single<br>end type<p>Public type iArr<br>  bByte(3) as Byte<br>end type<p>Dim sBinData as iBuff<br>Dim sBytData as iArr<br>Dim nValue as single<br>    For i = 0 To 3<br>        sBytData.bByte(3 - i) = RecvByteData(i)<br>    Next i<br>   LSet sBinData = sBytData<br>   nValue = sBinData.bFloat<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 14455-->
</ul><!--end: 14455-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?