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

📄 memform.frm

📁 支持PC机的各种端口的读写,包括,并口,串口,USB,等等
💻 FRM
字号:
VERSION 5.00
Begin VB.Form MemForm 
   Caption         =   "Memory test for TVicHW32.DLL 4.0"
   ClientHeight    =   4950
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9885
   LinkTopic       =   "Form1"
   ScaleHeight     =   4950
   ScaleWidth      =   9885
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Dentry 
      Caption         =   "Driver Entry Point"
      Height          =   1035
      Left            =   7140
      TabIndex        =   16
      Top             =   2100
      Width           =   2415
      Begin VB.OptionButton TVicDevice0 
         Caption         =   "TVicDevice0"
         Height          =   255
         Left            =   240
         TabIndex        =   18
         Top             =   300
         Value           =   -1  'True
         Width           =   1575
      End
      Begin VB.OptionButton TVicDevice1 
         Caption         =   "TVicDevice1"
         Height          =   255
         Left            =   240
         TabIndex        =   17
         Top             =   660
         Width           =   1575
      End
   End
   Begin VB.CommandButton B_Exit 
      Caption         =   "Exit"
      Height          =   495
      Left            =   7140
      TabIndex        =   15
      Top             =   4140
      Width           =   2415
   End
   Begin VB.Frame Frame1 
      Height          =   1455
      Left            =   7140
      TabIndex        =   10
      Top             =   480
      Width           =   2415
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         Caption         =   "mailto: ivi@ufanet.ru"
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   1080
         Width           =   2175
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         Caption         =   "Copyright (c) Victor Ishikeev"
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   840
         Width           =   2175
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         Caption         =   "Shareware v.m. 4.0"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   12
         Top             =   600
         Width           =   1935
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         Caption         =   "TVicHW32"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   204
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   0
         Left            =   240
         TabIndex        =   11
         Top             =   240
         Width           =   1935
      End
   End
   Begin VB.CommandButton Close_Driver 
      Caption         =   "Close TVicHW32"
      Height          =   495
      Left            =   8460
      TabIndex        =   9
      Top             =   3480
      Width           =   1095
   End
   Begin VB.CommandButton Open_Driver 
      Caption         =   "Open TVicHW32"
      Height          =   495
      Left            =   7140
      TabIndex        =   8
      Top             =   3480
      Width           =   1155
   End
   Begin VB.ListBox ListAddr 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   8.25
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3420
      Left            =   300
      TabIndex        =   4
      Top             =   600
      Width           =   975
   End
   Begin VB.ListBox ListHex 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   8.25
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3420
      Left            =   1320
      TabIndex        =   3
      Top             =   600
      Width           =   3495
   End
   Begin VB.ListBox ListAscii 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   8.25
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3420
      Left            =   4860
      TabIndex        =   2
      Top             =   600
      Width           =   1935
   End
   Begin VB.TextBox E_Base 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   5700
      TabIndex        =   1
      Text            =   "000c0044"
      Top             =   4200
      Width           =   1095
   End
   Begin VB.CommandButton B_ReadMemory 
      Caption         =   "Read 256 bytes from this physical memory adrress ==>"
      Height          =   435
      Left            =   300
      TabIndex        =   0
      Top             =   4200
      Width           =   5175
   End
   Begin VB.Label Label12 
      Caption         =   "Addr(hex)"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Label13 
      Caption         =   "H E X A D E C I M A L"
      Height          =   255
      Left            =   2100
      TabIndex        =   6
      Top             =   240
      Width           =   1935
   End
   Begin VB.Label Label14 
      Caption         =   "A S C I I"
      Height          =   255
      Left            =   5280
      TabIndex        =   5
      Top             =   240
      Width           =   1335
   End
End
Attribute VB_Name = "MemForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim HW32 As Long
Dim ActiveHW As Boolean
Dim PhysAddr As Long
Dim MappedAddr As Long


Private Sub B_Exit_Click()
  If ActiveHW Then HW32 = CloseTVicHW32(HW32)
  ActiveHW = False
  Unload MemForm
End Sub

Private Sub B_ReadMemory_Click()

  
  Dim s As String
  Dim CurrAddr As Long
  
  If ActiveHW Then
    
  'read base physical address from Edit box
  
    PhysAddr = HexToInt(E_Base.Text)
    E_Base.Text = IntToHex8(PhysAddr)
    MappedAddr = MapPhysToLinear(HW32, PhysAddr, 256)
  
  'display memory dump
  
    ListAddr.Clear
    ListHex.Clear
    ListAscii.Clear
    
  
    
      CurrAddr = PhysAddr
      Ofs% = 0
      Ofs0% = 0
      
      For i% = 1 To 16
        ListAddr.AddItem IntToHex8(CurrAddr)
        s = ""
        For j% = 1 To 16
          s = s + IntToHex2(GetMemByte(HW32, MappedAddr, Ofs%))
          Ofs% = Ofs% + 1
        Next j%
        ListHex.AddItem (s)
        s = ""
        For j% = 1 To 16
          b% = GetMemByte(HW32, MappedAddr, Ofs0%)
          Ofs0% = Ofs0% + 1
          If b% >= 32 Then
            ch$ = Chr(b%)
          Else: ch$ = "."
          End If

          s = s + ch$
        Next j%
        
        ListAscii.AddItem s
        CurrAddr = CurrAddr + 16
      Next i%
    End If

End Sub

Private Sub Close_Driver_Click()
 HW32 = CloseTVicHW32(HW32)
  Open_Driver.Enabled = True
  Close_Driver.Enabled = False
  ActiveHW = False

  B_ReadMemory.Enabled = False
  
End Sub

Private Sub Form_Load()
  Open_Driver.Enabled = True
  Close_Driver.Enabled = False
  B_ReadMemory.Enabled = False
End Sub

Private Sub Open_Driver_Click()
  HW32 = 0
  If TVicDevice0 Then
    HW32 = OpenTVicHW32(HW32, "TVICHW32", "TVicDevice0")
  Else
    HW32 = OpenTVicHW32(HW32, "TVICHW32", "TVicDevice1")
  End If
  If GetActiveHW(HW32) Then
    Open_Driver.Enabled = False
    Close_Driver.Enabled = True
    B_ReadMemory.Enabled = True
    ActiveHW = True
  Else
    Call MsgBox("Can't open the driver!", 0, "Warning!")
  End If
End Sub

⌨️ 快捷键说明

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