使用在GitHub上找到的HidLibrary DLL,但无法在我的WIN10计算机上找到任何已连接的HID设备。始终返回设备列表长度为零。我已经为实际连接的设备(鼠标,触摸屏等)尝试了多个供应商ID,PID。 HidDeviceList总是以0的长度返回。
Imports HIDLibrary
Imports System.Threading
Public Class Form1
Dim HidDeviceList As HIDLibrary.HidDevice()
Dim MyDevice As HidDevice
Dim DevDetected As Boolean
Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
Try
HidDeviceList = HidDevices.Enumerate(&H3F0) 'My HP wireless mouse
If HidDeviceList.Length > 0 Then
MyDevice = HidDeviceList(0)
DevDetected = True
End If
Catch ex As Exception
DisplayException(Me.Name, ex)
Throw
End Try
End Sub
End Class