📄 form1.frm
字号:
Width = 255
End
Begin VB.OptionButton Led_Off_1
Caption = "Option2"
Height = 300
Index = 0
Left = 120
TabIndex = 18
Top = 720
Value = -1 'True
Width = 255
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "亮"
Height = 180
Index = 0
Left = 480
TabIndex = 21
Top = 360
Width = 180
End
Begin VB.Label Label2
Caption = "灭"
Height = 255
Index = 0
Left = 480
TabIndex = 20
Top = 720
Width = 255
End
End
Begin VB.Frame Frame6
Caption = "LED2"
Height = 1095
Index = 1
Left = 1920
TabIndex = 12
Top = 3360
Width = 855
Begin VB.OptionButton Led_Off_2
Caption = "Option2"
Height = 300
Index = 1
Left = 120
TabIndex = 14
Top = 720
Value = -1 'True
Width = 255
End
Begin VB.OptionButton Led_On_2
Caption = "Option1"
Height = 255
Index = 1
Left = 120
TabIndex = 13
Top = 360
Width = 255
End
Begin VB.Label Label2
Caption = "灭"
Height = 255
Index = 1
Left = 480
TabIndex = 16
Top = 720
Width = 255
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "亮"
Height = 180
Index = 1
Left = 480
TabIndex = 15
Top = 360
Width = 180
End
End
Begin VB.TextBox Rec_Dat
BackColor = &H00404040&
ForeColor = &H00FFFF00&
Height = 735
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 9
Top = 1680
Width = 3495
End
Begin VB.CommandButton Clear_All
Caption = "清空"
Height = 375
Left = 5280
TabIndex = 8
Top = 2640
Width = 855
End
Begin VB.CommandButton Close_Dev
Caption = "关闭设备"
Enabled = 0 'False
Height = 375
Left = 4440
TabIndex = 7
Top = 2640
Width = 855
End
Begin VB.CommandButton Open_Dev
Caption = "打开设备"
Height = 375
Left = 3555
TabIndex = 6
Top = 2640
Width = 855
End
Begin VB.CommandButton Write_Ep2
Caption = "写端口2"
Height = 375
Left = 2700
TabIndex = 5
Top = 2640
Width = 855
End
Begin VB.CommandButton Read_Ep2
Caption = "读端口2"
Height = 375
Left = 1845
TabIndex = 4
Top = 2640
Width = 855
End
Begin VB.CommandButton Write_Ep1
Caption = "写端口1"
Height = 375
Left = 960
TabIndex = 3
Top = 2640
Width = 855
End
Begin VB.CommandButton Read_Ep1
Caption = "读端点1"
Height = 375
Left = 120
TabIndex = 2
Top = 2640
Width = 855
End
Begin VB.CommandButton WaterLight
BackColor = &H0080C0FF&
Caption = "流水灯(轻松一下)"
Height = 495
Left = 3720
TabIndex = 1
Top = 1440
Width = 2415
End
Begin VB.Timer Timer1
Left = 4680
Top = 600
End
Begin VB.ListBox lstResults
BackColor = &H00000000&
ForeColor = &H00FFFF00&
Height = 2220
ItemData = "Form1.frx":4B79
Left = 120
List = "Form1.frx":4B7B
TabIndex = 0
Top = 6240
Width = 6135
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "(端口2)LED灯控制区_______________________________________________"
Height = 375
Left = 240
TabIndex = 64
Top = 4560
Width = 5895
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "(端口2)发送区"
Height = 255
Left = 1680
TabIndex = 62
Top = 720
Width = 1215
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "____________________________LED灯控制区__________________________"
Height = 375
Left = 0
TabIndex = 61
Top = 0
Width = 5895
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "HEX显示"
Height = 255
Left = 2040
TabIndex = 60
Top = 1440
Width = 735
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "_________________________设备与系统交换信息区______________________"
Height = 255
Left = 120
TabIndex = 57
Top = 6000
Width = 6135
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "(端口1)LED灯控制区_______________________________________________"
Height = 375
Left = 240
TabIndex = 56
Top = 3120
Width = 5895
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "(端口1)发送区"
Height = 255
Left = 120
TabIndex = 55
Top = 720
Width = 1215
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "(端口1/2)接收区"
Height = 255
Left = 120
TabIndex = 54
Top = 1440
Width = 1455
End
Begin VB.Shape Key1
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderColor = &H00FFFFFF&
BorderStyle = 0 'Transparent
FillColor = &H000000FF&
Height = 375
Left = 5400
Shape = 3 'Circle
Top = 960
Width = 495
End
Begin VB.Shape Key2
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderColor = &H000000FF&
BorderStyle = 0 'Transparent
FillColor = &H000000FF&
Height = 375
Left = 4080
Shape = 3 'Circle
Top = 960
Width = 495
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "按键1"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Index = 8
Left = 3360
TabIndex = 11
Top = 1080
Width = 735
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "按键2"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 255
Left = 4680
TabIndex = 10
Top = 1080
Width = 735
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 15420
Left = 0
Picture = "Form1.frx":4B7D
Top = 0
Width = 19260
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'圈圈的驱动可能不是HID驱动,而是USB驱动
'圈圈的学习板应该不是HID设备吧
'因为我调用该函数HidD_GetPreparsedData()
'来获取HID设备特征信息就会内存报错
'是因为圈圈的学习板不是HID设备 而是一个USB设备
'Const MyVendorID = &H8888
'Const MyProductID = &H88
'**************************首先定义好圈圈的GUID************************
'Dim Capabilities As HIDP_CAPS
Dim DataString As String
Dim DetailData As Long
Dim DetailDataBuffer() As Byte
Dim DeviceAttributes As HIDD_ATTRIBUTES
Dim DevicePathName As String
Dim DeviceInfoSet As Long
Dim ErrorString As String
Dim HidDevice As Long
Dim LastDevice As Boolean
Dim MyDeviceDetected As Boolean
Dim MyDeviceInfoData As SP_DEVINFO_DATA
Dim MyDeviceInterfaceDetailData As SP_DEVICE_INTERFACE_DETAIL_DATA
Dim MyDeviceInterfaceData As SP_DEVICE_INTERFACE_DATA
Dim Needed As Long
Dim OutputReportData(7) As Byte
Dim PreparsedData As Long
Dim Result As Long
'对D12的读写的端口
Const File_Device = &H8000 '圈圈的文件设备
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -