VB代码转为Delphi..在线等.搞定就给分..(200)

  • 主题发起人 主题发起人 yeszhang
  • 开始时间 开始时间
Y

yeszhang

Unregistered / Unconfirmed
GUEST, unregistred user!
全局变量:Dim flngFpData(459) As Long Private Function FuncReadFromToDB() As Boolean 。。。省略一些代码.就是 打开 rsWrite数据集. FPDATA字段为 Image类型字段 vStr = rsWrite("FPDATA") ConvertByteToLongType vStrEnd FunctionPrivate Sub ConvertByteToLongType(astrBuff As String) Dim vnii As Long Dim vnLen As Long Dim vByte() As Byte vByte = astrBuff vnLen = UBound(flngFpData) For vnii = 0 To vnLen - 1 flngFpData(vnii) = vByte(vnii * 5 + 1) flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 2) flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 3) flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 4) If vByte(vnii * 5) = 0 Then flngFpData(vnii) = 0 - flngFpData(vnii) End If NextEnd Sub
 
重写一下:Dim flngFpData(459) As Long // flngFpData:array [0..458] of Integer;Private Sub ConvertByteToLongType(astrBuff As String) //astrBuff:String; Dim vnii As Long //vnii:Integer; Dim vnLen As Long Dim vByte() As Byte //vByte:PChar; vByte = astrBuff // vByte :=PChar(astrBuff); vnLen = UBound(flngFpData) //vnLen:=Length(flngFpData); For vnii = 0 To vnLen - 1 //For vnii := 0 To vnLen - 1 begin //Add flngFpData(vnii) = vByte(vnii * 5 + 1) //flngFpData[vnii] := Ord(vByte[vnii*5+1]); flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 2) // flngFpData[vnii] := flngFpData[vnii] * 256 + Ord(vByte[vnii * 5 + 2]) flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 3) flngFpData(vnii) = flngFpData(vnii) * 256 + vByte(vnii * 5 + 4) If vByte(vnii * 5) = 0 Then //if Ord(vByte[vnii * 5]) = 0 Then begin //Add flngFpData(vnii) = 0 - flngFpData(vnii) // flngFpData[vnii] := -flngFpData[vnii]; End If //--> End; End; //End For// NextEnd Sub //-->End
 
呵呵呵.多谢..
 
后退
顶部