如何与USB设备通信? [英] How to communicate with USB devices?

查看:108
本文介绍了如何与USB设备通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在一个需要vb检测2个USB设备并与之通信的项目.我是VB的新手.我想知道vb如何检测设备连接到哪个USB端口.如果可以,请向我发送源代码.我的电子邮件是*已删除邮件*.

顺便说一句,我已经从http://www.microsoft.com/downloads/e...DisplayLang=en下载并查看了代码.我了解此代码用于串行com RS232.它可以用于USB吗?

Hi,

I am working on a project which need vb to detect and communicate with 2 usb devices. I am quite new to VB. I would like to know how vb detect which usb port the device is connected to. Send me the source code if you can. My email is *REMOVED MAIL*.

Btw, I had downloaded and look at the code from http://www.microsoft.com/downloads/e...DisplayLang=en. I understand this code is used for serial com RS232. Will it work for USB?

Thanks.

推荐答案

在VB.Net中访问USB驱动器没有什么例外.
您可以使用DriveInfo(Syste.IO命名空间)类来访问可移动设备,例如USB.
有一个IsReady属性,它可以告诉您是否已连接USB设备.

在驱动器信息上找到一些很好的示例(它们全部在C#中)
1. http://www.majstro.com/Web/Bedrijf/cs/cs_System_IO_DriveInfo.html [^ ]
2. http://msdn.microsoft.com/en-us/library/system. io.driveinfo.aspx [ ^ ]
There is nothing exceptional in accessing USB drive in VB.Net.
You can make use of DriveInfo (Syste.IO namespace) class to access the removable device like USB.
There is a property IsReady which tells whether USB device is connected or not.

Find some good examples on drive info (they are all in C#)
1. http://www.majstro.com/Web/Bedrijf/cs/cs_System_IO_DriveInfo.html[^]
2. http://msdn.microsoft.com/en-us/library/system.io.driveinfo.aspx[^]


这篇关于如何与USB设备通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆