ReDim bytes(1 To num_bytes)
Get #fnum, , bytes
Close fnum
unk = Chr$(191)
i = 1
Do While i <= num_bytes
line1 = Format$(i, "@@@@@@: ")
line2 = " "
For j = 0 To 7
If i + j > num_bytes Then
line1 = line1 & " "
Else
ch = bytes(i + j)
line1 = line1 & Format$(Hex$(ch), "@@ ")
If ch >= 32 Then
line2 = line2 & Chr$(ch)
Else
line2 = line2 & unk
End If
End If
Next j
txt = txt & line1 & line2 & vbCrLf
i = i + 8
Loop
rchDisplay.Text = txt
End Sub
Private Sub Form_Load()
dlgFile.FileName = App.Path & "\*.*"
End Sub
Private Sub Form_Resize()
rchDisplay.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub mnuFileOpen_Click()
dlgFile.Flags = _
cdlOFNFileMustExist + _
cdlOFNHideReadOnly + _
cdlOFNLongNames
On Error Resume Next
dlgFile.ShowOpen
If Err.Number = cdlCancel Then Exit Sub
If Err.Number <> 0 Then
MsgBox "Error" & Str$(Err.Number) & _
" selecting file." & vbCrLf & Err.Description
End If
On Error GoTo 0
LoadFile dlgFile.FileName, dlgFile.FileTitle
End Sub