如何枚举所有HID设备? C#
我需要枚举连接到我的 PC 的所有 HID 设备。我尝试使用这个答案,但它枚举了 USBHub 设备,但我找不到我的 HID 设备。
编辑: 我很高兴知道是否有任何 WIN32 API 方法,可以使用 PID 和 VID 获取 USB 设备状态(在线/离线)?
I need to enumerate all HID devices connected to my PC. I tried to use this answer, but it enumerates USBHub devices and I can't find there my HID device.
EDIT:
I will be glad to know If there any WIN32 API method, to get USB device status (online/offline) using PID and VID?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了答案。 此链接说明了如何使用
ManagementObjectSearcher
执行此操作。感谢所有回复的人!
I found the answer. This link explains how to do this with
ManagementObjectSearcher
.Thanks for all who replied!
Microsoft 的 WDK 提供了 HID 功能的文档和概述如何使用它们。 WDK 还包括与访问 HID 类设备的 Visual C++ 程序一起使用的头文件(hidsdi.h、hidusage.h、hidpi.h)。
检查此链接 Jan Axelson 的 Lakeview 研究 - HID Windows 编程。
这里还有一个关于 HID 设备的问题:您在问题中指定:
使用 C# 扫描人机接口设备 (HID)< /a>
Microsoft's WDK has documentation for the HID functions and an overview of how to use them. The WDK also includes the header files to use with Visual C++ programs that access HID-class devices (hidsdi.h, hidusage.h, hidpi.h).
Check this link Jan Axelson's Lakeview Research - HID Windows Programming.
Here is an question also available regarding HID devices as you specified in your question:
Scanning for a Human Interface Device (HID) using C#
您可以使用 Windows API 枚举 Hid 设备,如下所示:
完整类: https://github.com/MelbourneDeveloper/Hid.Net/blob/master/Hid.Net/Windows/WindowsHIDDevice.cs
APIS:https://github.com/MelbourneDeveloper/Hid。 Net/blob/master/Hid.Net/Windows/APICalls.cs
You can enumerate Hid devices with Windows APIs like this:
Full class: https://github.com/MelbourneDeveloper/Hid.Net/blob/master/Hid.Net/Windows/WindowsHIDDevice.cs
APIS: https://github.com/MelbourneDeveloper/Hid.Net/blob/master/Hid.Net/Windows/APICalls.cs