Module mainModule
Private Const BUFFERSIZE As Long = 65535
'Private m_Width As Long
Private m_Height As Long

Sub Main()
Dim wysokość&
ReadImageInfo("x:\image.jpg")
wysokość = m_Height
End Sub


Public Sub ReadImageInfo(sFileName As String)
Dim bBuf(BUFFERSIZE) As Byte
Dim lPos As Long
' m_Width = 0
m_Height = 0


FileOpen(1, sFileName, OpenMode.Binary)
FileGet(1, 1, bBuf())
FileClose(1)


Do
If (bBuf(lPos) = &HFF And bBuf(lPos + 1) = &HD8 And bBuf(lPos + 2) = &HFF) Or (lPos >= BUFFERSIZE - 10) Then Exit Do
lPos = lPos + 1
Loop


lPos = lPos + 2
If lPos >= BUFFERSIZE - 10 Then Exit Sub


Do
Do
If bBuf(lPos) = &HFF And bBuf(lPos + 1) <> &HFF Then Exit Do
lPos = lPos + 1
If lPos >= BUFFERSIZE - 10 Then Exit Sub
Loop
lPos = lPos + 1


Select Case bBuf(lPos)
Case &HC0 To &HC3, &HC5 To &HC7, &HC9 To &HCB, &HCD To &HCF
Exit Do
End Select
lPos = lPos + Mult(bBuf(lPos + 2), bBuf(lPos + 1))
If lPos >= BUFFERSIZE - 10 Then Exit Sub
Loop
m_Height = Mult(bBuf(lPos + 5), bBuf(lPos + 4))
' m_Width = Mult(bBuf(lPos + 7), bBuf(lPos + 6))
End Sub


Private Function Mult(lsb As Byte, msb As Byte) As Long
Mult = lsb + (msb * CLng(256))
End Function
End Module




wiersz 19(błąd) = FileGet(1, 1, bBuf())
tu w jest podkreślony nawias() z opisem:
Liczba indeksów jest mniejsza niż liczba wymiarów tablicy indeksowanej


Proszę o pomoc w usunięciu tego błędu.