1. Form을 하나 만든다.
2. Data 라는 FlexGrid를 추가
3. CmdBinary 와 CmdRead 라는 Button 컨트롤 추가
4.
Option Explicit
Private Sub CmdBinary_Click()
Dim fn As Integer
Dim strFile As String
Dim strTxt As String
strFile = App.Path & "\C111118A_YP_T-CAR_NCAP.R64"
fn = FreeFile
Dim arrBytes() As Byte
ReDim arrBytes(FileLen(strFile))
Open strFile For Binary As #fn
Dim mystring As String
mystring = Space(LOF(fn))
If Not EOF(fn) Then
Get #fn, , arrBytes
Get #fn, , mystring
'mystring = StrConv(arrBytes, vbUnicode)
End If
Close #fn
Dim j As String
If InStr(StrConv(arrBytes, vbUnicode), Chr(0)) Then
j = Left(StrConv(arrBytes, vbUnicode), InStr(StrConv(arrBytes, vbUnicode), Chr(0)) - 1)
Txt1.Text = j
End If
Dim i As Integer
With Data
.ScrollTrack = True
.Cols = 4
.ColAlignment(0) = flexAlignCenterCenter
.ColAlignment(1) = flexAlignCenterCenter
.ColAlignment(2) = flexAlignCenterCenter
.Rows = 15000
.TextMatrix(0, 1) = "arrBytes"
For i = 1 To .Rows - 1
.TextMatrix(i, 0) = i
.TextMatrix(i, 1) = arrBytes(i - 1)
.TextMatrix(i, 2) = StrConv(arrBytes(i - 1), vbUnicode)
.TextMatrix(i, 3) = Chr(arrBytes(i - 1))
Next
End With
'Txt1.Text = mystring
End Sub
Private Sub CmdRead_Click()
Dim filenum As Integer
filenum = FreeFile
Open App.Path & "\C120823B.R64" For Binary As filenum
Dim BytePosition As Long
Dim StringSize As Long
Dim GetString As String
Dim intTemp As Integer
'자료 크기만큼 메모리 할당
GetString = String(8, " ") 'StringSize, " ")
Get filenum, 80, GetString
Txt1.Text = StrConv(GetString, vbUnicode)
Close filenum
End Sub
댓글 없음:
댓글 쓰기