⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hexdump.frm

📁 读16进制的文件
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "comdlg32.ocx"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "richtx32.ocx"
Begin VB.Form HexDumpForm 
   Caption         =   "HexDump"
   ClientHeight    =   4170
   ClientLeft      =   1620
   ClientTop       =   1830
   ClientWidth     =   7545
   LinkTopic       =   "Form1"
   ScaleHeight     =   4170
   ScaleWidth      =   7545
   Begin RichTextLib.RichTextBox rchDisplay 
      Height          =   3255
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   3735
      _ExtentX        =   6588
      _ExtentY        =   5741
      _Version        =   327681
      Enabled         =   -1  'True
      ScrollBars      =   3
      TextRTF         =   $"HexDump.frx":0000
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Courier New"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComDlg.CommonDialog dlgFile 
      Left            =   3360
      Top             =   3600
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   327681
      CancelError     =   -1  'True
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuFileOpen 
         Caption         =   "&Open"
         Shortcut        =   ^O
      End
      Begin VB.Menu mnuFileSep 
         Caption         =   "-"
      End
      Begin VB.Menu mnuFileExit 
         Caption         =   "E&xit"
      End
   End
End
Attribute VB_Name = "HexDumpForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private FileName As String
Private FileTitle As String
' Load and display the file.
Private Sub LoadFile(fname As String, ftitle As String)
Dim fnum As Integer
Dim num_bytes As Integer
Dim bytes() As Byte
Dim txt As String
Dim line1 As String
Dim line2 As String
Dim unk As String
Dim ch As Integer
Dim i As Integer
Dim j As Integer

    ' Prepare the display.
    rchDisplay.Text = ""
    FileName = fname
    FileTitle = ftitle
    Caption = "HexDump [" & ftitle & "]"
    DoEvents

    ' Read the file.
    fnum = FreeFile
    Open fname For Binary As #fnum
    num_bytes = LOF(fnum)
    ReDim bytes(1 To num_bytes)
    Get #fnum, , bytes
    Close fnum

    ' Display the data.
    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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -