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

📄 testform.frm

📁 支持PC机的各种端口的读写,包括,并口,串口,USB,等等
💻 FRM
字号:
VERSION 5.00
Begin VB.Form IoForm 
   Caption         =   "I/O array Test TVicHW32.DLL 4.0"
   ClientHeight    =   4110
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7830
   LinkTopic       =   "Form1"
   ScaleHeight     =   4110
   ScaleWidth      =   7830
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox Memo 
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   6.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2595
      Left            =   60
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   19
      Top             =   1440
      Width           =   5050
   End
   Begin VB.CommandButton B_Read 
      Caption         =   "Read 256 bytes from a port"
      Height          =   375
      Left            =   2640
      TabIndex        =   18
      Top             =   960
      Width           =   2460
   End
   Begin VB.TextBox Addr 
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   6.75
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   4545
      TabIndex        =   16
      Text            =   "300"
      Top             =   480
      Width           =   555
   End
   Begin VB.Frame Frame2 
      Caption         =   " Port wide "
      Height          =   1335
      Left            =   60
      TabIndex        =   12
      Top             =   60
      Width           =   2235
      Begin VB.OptionButton Option3 
         Caption         =   "Four Bytes (DWord)"
         Height          =   315
         Left            =   120
         TabIndex        =   15
         Top             =   840
         Width           =   1995
      End
      Begin VB.OptionButton Option2 
         Caption         =   "Two Bytes (Word)"
         Height          =   315
         Left            =   120
         TabIndex        =   14
         Top             =   540
         Width           =   1635
      End
      Begin VB.OptionButton Option1 
         Caption         =   "One Byte"
         Height          =   195
         Left            =   120
         TabIndex        =   13
         Top             =   300
         Value           =   -1  'True
         Width           =   1875
      End
   End
   Begin VB.Frame Dentry 
      Caption         =   "Driver Entry Point"
      Height          =   1035
      Left            =   5280
      TabIndex        =   9
      Top             =   1680
      Width           =   2415
      Begin VB.OptionButton TVicDevice0 
         Caption         =   "TVicDevice0"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   300
         Value           =   -1  'True
         Width           =   1575
      End
      Begin VB.OptionButton TVicDevice1 
         Caption         =   "TVicDevice1"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   660
         Width           =   1575
      End
   End
   Begin VB.CommandButton Open_Driver 
      Caption         =   "Open TVicHW32"
      Height          =   495
      Left            =   5280
      TabIndex        =   8
      Top             =   2820
      Width           =   1155
   End
   Begin VB.CommandButton Close_Driver 
      Caption         =   "Close TVicHW32"
      Height          =   495
      Left            =   6540
      TabIndex        =   7
      Top             =   2820
      Width           =   1155
   End
   Begin VB.Frame Frame1 
      Height          =   1455
      Left            =   5280
      TabIndex        =   2
      Top             =   60
      Width           =   2415
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         Caption         =   "TVicHW32"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   1935
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         Caption         =   "Shareware v.m. 4.0"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   5
         Top             =   600
         Width           =   1935
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         Caption         =   "Copyright (c) Victor Ishikeev"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   840
         Width           =   2175
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         Caption         =   "mailto: ivi@ufanet.ru"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   1080
         Width           =   2175
      End
   End
   Begin VB.CommandButton B_Exit 
      Caption         =   "Exit"
      Height          =   495
      Left            =   5280
      TabIndex        =   1
      Top             =   3540
      Width           =   2415
   End
   Begin VB.CheckBox C_Hard 
      Caption         =   """hard"" access to the ports"
      Height          =   315
      Left            =   2640
      TabIndex        =   0
      Top             =   120
      Value           =   1  'Checked
      Width           =   2295
   End
   Begin VB.Label Label1 
      Caption         =   "Port address (hex) :"
      Height          =   255
      Left            =   2640
      TabIndex        =   17
      Top             =   540
      Width           =   1695
   End
End
Attribute VB_Name = "IoForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'=======================================================
'=====     Test example for TVicHW32.DLL 4.0       =====
'=======================================================
'== Copyright(c) 1999 Victor Ishikeev (ivi@ufanet.ru) ==
'=======================================================

Private Type PortByteFifo
       PortAddr     As Long
       NumPorts     As Long
       Buffer(256)  As Byte
End Type

Private Type PortWordFifo
       PortAddr     As Long
       NumPorts     As Long
       Buffer(128)  As Integer
End Type

Private Type PortLongFifo
       PortAddr     As Long
       NumPorts     As Long
       Buffer(64)   As Long
End Type

Dim ByteFifo As PortByteFifo
Dim WordFifo As PortWordFifo
Dim LongFifo As PortLongFifo

Dim HW32 As Long
Dim ActiveHW As Boolean


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

Private Sub B_Read_Click()
  Dim PortAddr As Long
  PortAddr = HexToInt(Addr.Text)
  
  Addr.Text = Hex(PortAddr)
  
  Memo.Text = ""
  Rem  Single Bytes
  If Option1.Value Then
  
    ByteFifo.PortAddr = PortAddr
    ByteFifo.NumPorts = 256
    ReadPortFIFO HW32, ByteFifo
    For i% = 1 To 256
      Memo.Text = Memo.Text + Hex(ByteFifo.Buffer(i%))
    Next i%
    
  End If
  
  Rem  Words
  
  If Option2.Value Then
  
    WordFifo.PortAddr = PortAddr
    WordFifo.NumPorts = 128
    ReadPortWFIFO HW32, WordFifo
    For i% = 1 To 128
      Memo.Text = Memo.Text + Hex(WordFifo.Buffer(i%))
    Next i%
    
  End If
  Rem   Double Words
  If Option3.Value Then
  
    LongFifo.NumPorts = 64
    LongFifo.PortAddr = PortAddr
    ReadPortLFIFO HW32, LongFifo
    For i% = 1 To 64
      Memo.Text = Memo.Text + Hex(LongFifo.Buffer(i%))
    Next i%
    
  End If

End Sub

Private Sub C_Hard_Click()
  Call SetHardAccess(HW32, C_Hard.Value)
End Sub

Private Sub Close_Driver_Click()
  HW32 = CloseTVicHW32(HW32)
  Open_Driver.Enabled = True
  Close_Driver.Enabled = False
  C_Hard.Enabled = True
  B_Read.Enabled = False
End Sub

Private Sub Form_Load()
  HW32 = 0
  ActiveHW = False
  Open_Driver.Enabled = True
  Close_Driver.Enabled = False
  C_Hard.Enabled = False
  B_Read.Enabled = Falses
End Sub

Private Sub Form_Unload(Cancel As Integer)
 If ActiveHW Then HW32 = CloseTVicHW32(HW32)
  ActiveHW = 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_Read.Enabled = True
    ActiveHW = True
    C_Hard.Enabled = True
    C_Hard.Value = 1
  Else
    Call MsgBox("Can't open the driver!", 0, "Warning!")
  End If
    
End Sub

⌨️ 快捷键说明

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