读书人

quot;byref参数类型不符quot;是哪错了,该如何解

发布时间: 2012-01-21 21:31:43 作者: rapoo

"byref参数类型不符"是哪错了
dim i as long
For i = j * 256 To SectionNumbers - 1
New_Section (i)
New_Data_Desc (i)
'最后块

' If (j < Sub_Table_Num) Then
Ts_Data(i).Last_Section_Number = SectionNumbers
Ts_Data(i).Section_Number = i
' Else
' Ts_Data(i).Last_Section_Number = SectionNumbers Mod 256
' End If
'描述符长度
Ts_Soft_Desc(i).Descriptor_Length = 11 'byte
Ts_Soft_Desc(i).Last_Table_Id = Sub_Table_Num '最后的表的ID
Ts_Soft_Desc(i).Software_Size = FileLength '文件长度
Ts_Soft_Desc(i).Software_CRC = fCRC32 '文件CRC32
Ts_Data(i).TS_Descriptor = Ts_Soft_Desc(i)
'下载符长度
Ts_Data(i).Descriptor_Loop_Length = 13
'字段长度
Ts_Data(i).Section_Length = 7 + 13 + Payload_Data_Length + 4 '24byte+数据长度
Ts_Data(i).Sub_Table_ID = 0

For k = ilen To (Payload_Data_Length * (i + 1)) - 1
DoEvents
Seek #1, k + 1
Get #1, , sbyte
Ts_Data(i).Payload_Data(k - Payload_Data_Length * i) = sbyte
Next

SectionCRC i, lCRC32 '这里提示"byref参数类型不符",如何改正?
Ts_Data(i).TS_Descriptor.Software_CRC = lCRC32

ilen = ilen + Payload_Data_Length


Next


'得到Section的CRC值

Public Sub SectionCRC(k As long, Optional rResult As Long)

Dim myByte(0 To 3094) As Byte
myByte(0) = FristByte(Ts_Data(k).Table_Id)
myByte(1) = SecondByte(Ts_Data(k).Section_Syntax_Indicator, Ts_Data(k).Reserved_Feature_Use3, Ts_Data(k).Section_Length)
myByte(2) = ThirdByte(Ts_Data(k).Section_Length)
myByte(3) = FourthByte(Ts_Data(k).Reserved_Feature_Use11)
myByte(4) = FifthByte(Ts_Data(k).Reserved_Feature_Use11, Ts_Data(k).Sub_Table_ID)
myByte(5) = SixthByte(Ts_Data(k).Reserved_Feature_Use2, Ts_Data(k).Version_Number, Ts_Data(k).Current_Next_Indicator)
myByte(6) = SeventhByte(Ts_Data(k).Section_Number)
myByte(7) = EighthByte(Ts_Data(k).Last_Section_Number)
myByte(8) = NinthByte(Ts_Data(k).Reserved_Feature_Use4, Ts_Data(k).Descriptor_Loop_Length)
myByte(9) = TenthByte(Ts_Data(k).Descriptor_Loop_Length)

myByte(10) = Desc_1Byte(Ts_Data(k).TS_Descriptor.Descriptor_Tag)
myByte(11) = Desc_2Byte(Ts_Data(k).TS_Descriptor.Descriptor_Length)
myByte(12) = Desc_3Byte(Ts_Data(k).TS_Descriptor.Software_Version)
myByte(13) = Desc_4Byte(Ts_Data(k).TS_Descriptor.Software_Version)

myByte(14) = Desc_5Byte(Ts_Data(k).TS_Descriptor.Software_Size)
myByte(15) = Desc_6Byte(Ts_Data(k).TS_Descriptor.Software_Size)
myByte(16) = Desc_7Byte(Ts_Data(k).TS_Descriptor.Software_Size)
myByte(17) = Desc_8Byte(Ts_Data(k).TS_Descriptor.Software_Size)

myByte(18) = Desc_9Byte(Ts_Data(k).TS_Descriptor.Software_CRC)


myByte(19) = Desc_10Byte(Ts_Data(k).TS_Descriptor.Software_CRC)
myByte(20) = Desc_11Byte(Ts_Data(k).TS_Descriptor.Software_CRC)
myByte(21) = Desc_12Byte(Ts_Data(k).TS_Descriptor.Software_CRC)
myByte(22) = Desc_13Byte(Ts_Data(k).TS_Descriptor.Last_Table_Id, Ts_Data(k).TS_Descriptor.Reserved_Feature_Use3)

For j = 0 To 3071
myByte(23 + j) = Ts_Data(k).Payload_Data(j)
Next

Dim cCRC32 As New cCRC32
Dim CRC As Long
rResult = cCRC32.GetByteArrayCrc32(myByte())

End Sub





[解决办法]
加上一句: dim lCRC32 as long
[解决办法]

Public Sub SectionCRC(k As long, Optional rResult As Long) 改为

Public Sub SectionCRC(ByVal k As Long, Optional ByVal rResult As Long)
试一试
[解决办法]
老张看一下他的sub,其结果是要修改参数 rResult的,只能是byref吧?
[解决办法]
不懂,up
[解决办法]
不懂,up
[解决办法]
应该是这里的问题吧:
cCRC32.GetByteArrayCrc32(myByte())
[解决办法]
加上
Dim i as long
Dim lCRC32 as long
就可以了

读书人网 >VB

热点推荐