📄 usbio.frm
字号:
Begin VB.CommandButton SetDeviceOptions
Caption = "Set Device Options"
Height = 375
Left = 2040
TabIndex = 167
Top = 360
Width = 1695
End
Begin VB.CommandButton GetDeviceOptions
Caption = "Get Device Options"
Height = 375
Left = 120
TabIndex = 165
Top = 360
Width = 1695
End
End
Begin VB.Frame RequestTimeoutFrame
Caption = "Request Timeout"
Height = 1455
Left = 240
TabIndex = 159
Top = 3720
Width = 4095
Begin VB.TextBox SetRequestTimeoutField
Height = 285
Left = 2760
TabIndex = 162
Text = "1000"
Top = 960
Width = 615
End
Begin VB.CommandButton SetRequestTimeout
Caption = "Set Request Timeout"
Height = 375
Left = 2160
TabIndex = 163
Top = 360
Width = 1815
End
Begin VB.TextBox GetRequestTimeoutField
Height = 285
Left = 720
Locked = -1 'True
TabIndex = 161
TabStop = 0 'False
Top = 960
Width = 615
End
Begin VB.CommandButton GetRequestTimeout
Caption = "Get Request Timeout"
Height = 375
Left = 120
TabIndex = 160
Top = 360
Width = 1815
End
End
Begin VB.Frame VersionFrame
Caption = "Version"
Height = 1575
Left = 240
TabIndex = 114
Top = 2040
Width = 5775
Begin VB.TextBox CheckedBuildVersionField
Height = 285
Left = 4920
Locked = -1 'True
TabIndex = 170
TabStop = 0 'False
Top = 1080
Width = 615
End
Begin VB.TextBox DemoVersionField
Height = 285
Left = 2520
Locked = -1 'True
TabIndex = 169
TabStop = 0 'False
Top = 1080
Width = 615
End
Begin VB.TextBox FlagsField
Height = 285
Left = 4920
Locked = -1 'True
TabIndex = 119
TabStop = 0 'False
Top = 720
Width = 615
End
Begin VB.TextBox DriverBuildNumberField
Height = 285
Left = 4920
Locked = -1 'True
TabIndex = 118
TabStop = 0 'False
Top = 360
Width = 615
End
Begin VB.TextBox DriverVersionField
Height = 285
Left = 2520
Locked = -1 'True
TabIndex = 117
TabStop = 0 'False
Top = 720
Width = 615
End
Begin VB.TextBox APIVersionField
BeginProperty DataFormat
Type = 0
Format = "9.00"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1031
SubFormatType = 0
EndProperty
Height = 285
Left = 2520
Locked = -1 'True
TabIndex = 116
TabStop = 0 'False
Top = 360
Width = 615
End
Begin VB.CommandButton GetVersion
Caption = "Get Version"
Height = 495
Left = 120
TabIndex = 115
Top = 360
Width = 1095
End
Begin VB.Label CheckedBuildVersionLabe
Caption = "Checked Build"
Height = 255
Left = 3360
TabIndex = 172
Top = 1080
Width = 1455
End
Begin VB.Label DemoVersionLabel
Caption = "Demo Version"
Height = 255
Left = 1320
TabIndex = 171
Top = 1080
Width = 1095
End
Begin VB.Label DriverBuildNumberLabel
Caption = "Driver Build Number"
Height = 255
Left = 3360
TabIndex = 123
Top = 360
Width = 1455
End
Begin VB.Label FlagsLabel
Caption = "Flags"
Height = 255
Left = 3360
TabIndex = 122
Top = 720
Width = 975
End
Begin VB.Label DriverVersionLabel
Caption = "Driver Version"
Height = 255
Left = 1320
TabIndex = 121
Top = 720
Width = 1095
End
Begin VB.Label APIVersionLabel
Caption = "API Version"
Height = 255
Left = 1320
TabIndex = 120
Top = 360
Width = 1095
End
End
Begin VB.Frame DevicesFrame
Caption = "Devices"
Height = 1575
Left = 2760
TabIndex = 113
Top = 360
Width = 5535
Begin VB.CommandButton ReleaseButton
Caption = "Release"
Height = 495
Left = 3480
TabIndex = 204
Top = 960
Width = 1815
End
Begin VB.CommandButton AcquireButton
Caption = "Acquire"
Height = 495
Left = 3480
TabIndex = 203
Top = 360
Width = 1815
End
Begin VB.TextBox DeviceInstanceField
Height = 285
Left = 2640
MaxLength = 3
TabIndex = 110
Text = "0"
Top = 480
Width = 375
End
Begin VB.CommandButton OpenDevice
Caption = "Open Device"
Height = 495
Left = 120
TabIndex = 111
Top = 360
Width = 975
End
Begin VB.CommandButton CloseDevice
Caption = "Close Device"
Height = 495
Left = 120
TabIndex = 112
Top = 960
Width = 975
End
Begin VB.Label DeviceInstanceLabel
Caption = "Device Instance"
Height = 255
Left = 1200
TabIndex = 155
Top = 480
Width = 1335
End
End
Begin VB.Frame EnumerateFrame
Caption = "Enumerate"
Height = 1575
Left = 240
TabIndex = 107
Top = 360
Width = 2415
Begin VB.CommandButton NumberOfDevices
Caption = "Enumerate Devices"
Height = 495
Left = 360
TabIndex = 109
Top = 360
Width = 1695
End
Begin VB.TextBox NumberOfDevicesField
Height = 285
Left = 1800
Locked = -1 'True
TabIndex = 108
TabStop = 0 'False
Top = 1080
Width = 375
End
Begin VB.Label NumberOfDevicesLabel
Caption = "Number of Devices"
Height = 255
Left = 240
TabIndex = 154
Top = 1080
Width = 1455
End
End
End
End
Attribute VB_Name = "USBIOCOMForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'(c) 2001-2002 Thesycon Systemsoftware & Consulting GmbH
'
'This is a sample program for the USBIOCOM interface. It
'requires the registered USBIOCOM interface and the USBIO
'device driver. Furthermore, an USB test device is required.
'
'An USB mouse or keyboard can be used as test device for example.
'Note: The test device cannot be used as a Windows input device at the same time.
'
'For detailed information on the USBIOCOM interface refer to the
'documentation in usbiocom.pdf. For information on the USBIO
'device driver an its API refer to usbioman.pdf.
'
'For latest updates visit http://www.thesycon.de
'
'
'How to use this sample application:
'1. Connect an USB device with at least one IN endpoint to the PC.
'
'2. Use the USBIO install wizard to install the USBIO device driver
'for this device.
'
'3. Make sure that the USBIOCOM interface is registered on the PC.
'Normally, this is done during installation. You can run the command
'>regsvr32 usbiocom.dll
'to register the USBIOCOM interface manually.
'
'4. Run this application and carry out the following actions:
'a) press "Number of Devices" -> Number of devices should be at least 1
'b) press "Open Device"
'c) switch to the "Interface" page
'd) enter interface and alternate setting, press "Add Interface"
'e) press "Set Configuration"
'f) enter the endpoint address, add 128 (80 hex) for IN endpoints
'g) press "Bind"
'h) switch to the "Read" page
'i) press "Start Read"
'j) press keys on the keyboard or move the mouse
'k) press "Stop Read", the file should contain the received data
'
'
' We define global variables that hold the instances of the USBIO COM object.
' We need to use the "WithEvents" attribute.
' This one represents the USB device.
Dim WithEvents USBDevice As USBIOCOMLib.USBIOInterface3
Attribute USBDevice.VB_VarHelpID = -1
' This one represents a data pipe (USB endpoint).
' Note: To keep it simple we use one data pipe only.
' However, if more that one endpoint shall be used then one instance
' is required for each of them.
Dim WithEvents USBPipe As USBIOCOMLib.USBIOInterface3
Attribute USBPipe.VB_VarHelpID = -1
' The USBIOCOM_ERR_CODES enum is defined in the USBIOCOM Type Library.
Dim status As USBIOCOMLib.USBIOCOM_ERR_CODES
'define an array of bytes used for read and write operations
Dim buffer() As Byte
Dim intbuffer() As Long
Dim intbuffer2() As Long
Dim buf() As Byte
Dim mintCurFrame As Integer
Dim fileopen As Boolean
Dim tempbuf(7) As Byte
Dim UserId As Long
Dim writing As Boolean
Dim reading As Boolean
Dim BufferSize As Long
Dim BufferCount As Long
Dim ErrorCount As Long
Dim IsIsoFlag As Boolean
Dim WriteToFile As Boolean
Dim fifosize As Long
Dim wBufferSize As Long
Dim wBufferCount As Long
Dim wErrorCount As Long
Dim wIsIsoFlag As Boolean
Dim ReadFromFile As Boolean
Dim wBufferValue As Long
Dim WriteStatus As Boolean
' ************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -