VB.Net:检测网络摄像头
如何以编程方式检测网络摄像头设备是否已插入 PC,返回“True”或“False”。
How can I programmatically detect whether a webcam device is plugged in to the PC or not, return 'True' or 'False.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能是更好的方法,但我能想到的唯一方法是使用 GetRawInputDeviceList 枚举所有 USB 设备,然后使用 GetRawInputDeviceInfo 获取有关的更多信息他们。
网络摄像头应该显示为 HID,但我不知道是否有任何方法可以确定它是否是网络摄像头。
请参阅此处获取 C# 示例(可能会使用 C# 到 VB.Net如果您不熟悉 C#,请使用转换器)。
Might be some better way of doing this but the only one I can think of would be to use
GetRawInputDeviceList
to enumerate all USB devices and then usingGetRawInputDeviceInfo
to get out more information about them.Webcams should show up as HID, but I don't know if there's any way to tell for sure if it's a webcam.
See here for a C# sample (could probably use a C# to VB.Net converter if you're not comfortable with C#).