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

📄 frmmain.frm

📁 usb HID类设备通讯源程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   Caption         =   "USB1.1 HID类中断传输"
   ClientHeight    =   8115
   ClientLeft      =   3900
   ClientTop       =   1305
   ClientWidth     =   8040
   LinkTopic       =   "Form1"
   ScaleHeight     =   8115
   ScaleWidth      =   8040
   Begin VB.Frame fraDeviceAddress 
      Caption         =   "Device Symbol"
      Height          =   5655
      Left            =   120
      TabIndex        =   5
      Top             =   2280
      Width           =   1575
      Begin VB.OptionButton optDeviceSymbol3 
         Caption         =   "Option3"
         Height          =   1455
         Left            =   120
         TabIndex        =   8
         Top             =   3720
         Width           =   1335
      End
      Begin VB.OptionButton optDeviceSymbol2 
         Caption         =   "Option2"
         Height          =   1695
         Left            =   120
         TabIndex        =   7
         Top             =   1920
         Width           =   1215
      End
      Begin VB.OptionButton optDeviceSymbol1 
         Caption         =   "Option1"
         Height          =   1575
         Left            =   120
         TabIndex        =   6
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.CommandButton cmdManPowerDetect 
      Caption         =   "Detect Device"
      Height          =   735
      Left            =   0
      TabIndex        =   4
      Top             =   1320
      Width           =   1935
   End
   Begin VB.CommandButton cmdOnce 
      Caption         =   "Transmit"
      Height          =   735
      Left            =   0
      TabIndex        =   3
      Top             =   360
      Width           =   1935
   End
   Begin VB.Frame fraBytesReceived 
      Caption         =   "Packet number"
      Height          =   7815
      Left            =   1920
      TabIndex        =   1
      Top             =   120
      Width           =   1455
      Begin VB.TextBox txtBytesReceived 
         Height          =   7335
         Left            =   120
         MultiLine       =   -1  'True
         TabIndex        =   2
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.ListBox lstResults 
      Height          =   7620
      Left            =   3600
      TabIndex        =   0
      Top             =   240
      Width           =   3975
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdManPowerDetect_Click()

frmMain.optDeviceSymbol1.Enabled = False
frmMain.optDeviceSymbol2.Enabled = False
frmMain.optDeviceSymbol3.Enabled = False
frmMain.cmdOnce.Enabled = False
frmMain.cmdOnce.Caption = "No device detected!"
Call FindTheHid

End Sub

Private Sub cmdOnce_Click()

'optDeviceSymbol1.Enabled = False
Call ReadAndWriteToDevice
'optDeviceSymbol1.Enabled = True

End Sub
Private Sub Form_Load()

frmMain.Show

Call InitializeDisplay

End Sub
Private Sub Form_Unload(Cancel As Integer)

Call Shutdown

End Sub
Private Sub Shutdown()

Result = CloseHandle _
    (HIDHandle)
    
Result = CloseHandle _
    (ReadHandle)
    
End Sub

Private Sub optDeviceSymbol1_Click()

'HIDHandle = ProductInformation(0).WriteCode
'ReadHandle = ProductInformation(0).ReadCode

End Sub

Private Sub optDeviceSymbol2_Click()

'HIDHandle = ProductInformation(1).WriteCode
'ReadHandle = ProductInformation(1).ReadCode

End Sub

Private Sub optDeviceSymbol3_Click()

'HIDHandle = ProductInformation(2).WriteCode
'ReadHandle = ProductInformation(2).ReadCode

End Sub

⌨️ 快捷键说明

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