|
|
高手!帮我看看那里出错了,说下标出界,本人不懂程序,用一个解压缩程序改的
Private Sub CmdEncrypt_Click()
Dim temp(8) As Integer
Dim CurPos As Long
Dim j As Integer
Dim a As Integer
Dim b As Integer
Dim r As Integer
Dim l As Integer
Dim y As Integer
Dim I As Integer
Dim X As Integer
CD.ShowOpen
filename = CD.filename
filename2 = "2.txt"
CurPos = 0
If Len(filename) = 0 Then Exit Sub
StatusBar.SimpleText = "Start Encoding..."
Open filename For Binary As #1
ReDim databuff(LOF(1) - 1)
Get #1, , databuff
Close #1
I = 0
j = 0
While I < UBound(databuff)
If I = 0 Then
l = databuff(0) * 16 * 16 + databuff(1) - 1
ReDim addbuff(l) As Byte
I = 2
Else
For r = 0 To 8
temp(r) = 1
Next
If j < UBound(addbuff) Then
y = Int(databuff(I))
If y >= 128 Then
y = (y - 128)
temp(7) = 0
End If
If y >= 64 Then
y = (y - 64)
temp(6) = 0
End If
If y >= 32 Then
y = (y - 32)
temp(5) = 0
End If
If y >= 16 Then
y = (y - 16)
temp(4) = 0
End If
If y >= 8 Then
y = (y - 8)
temp(3) = 0
End If
If y >= 4 Then
y = (y - 4)
temp(2) = 0
End If
If y >= 2 Then
y = (y - 2)
temp(1) = 0
End If
If y >= 1 Then
y = (y - 1)
temp(0) = 0
End If
I = (I + 1)
For X = 0 To 8
If temp(X) = 0 Then
addbuff(j) = databuff(I)
j = (j + 1)
I = (I + 1)
End If
If temp(X) = 1 Then
If j < 4079 And databuff(I + 1) > 240 Then
a = databuff(I) - 238
CurPos = Int(a)
b = databuff(I + 1) - Int(databuff(I + 1) / 16) * 16 + 3
Else
a = databuff(I) + Int(databuff(I + 1) / 16) * 16 * 16 + 12
a = Int(a)
b = databuff(I + 1) - Int(databuff(I + 1) / 16) * 16 + 3
End If
For r = 0 To b
addbuff(j) = addbuff(CurPos)
CurPos = CurPos + 1
Next
I = I + 1
End If
Next
End If
End If
Wend
Open filename2 For Binary As #1
Put #1, , addbuff
Close #1
StatusBar.SimpleText = "over"
End Sub |
|