By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,053 Members | 1,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,053 IT Pros & Developers. It's quick & easy.

Detect usb drive and his name

P: n/a
Hi

I just want to know how do I detect an usb drive when it's plug and
retrieve his name, in vb.net

Thanx
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

You'll need WMI for this. It will allow you to enumerate all removable
devices in the system and query their properties such as label, serial
number etc. If you want notification of when a drive is connected, WMI
should be able to handle that as well.

There is an excellent WMI plugin for the server explorer in VS.NET available
free on the MS website, it will assist in wiring up event code for WMI
classes.

Good luck!
Alex Clark

"ladal" <la***@hotmail.fr> wrote in message
news:13**************************@posting.google.c om...
Hi

I just want to know how do I detect an usb drive when it's plug and
retrieve his name, in vb.net

Thanx

Nov 21 '05 #2

P: n/a
Monitor WM_DEVICECHANGE messages and watch for the DBT_DEVICEARRIVAL and
DBT_DEVICEREMOVECOMPLETE messages pertaining to your device. Also look at
RegisterDeviceNotification.

Also, check RegisterDeviceNotification in the Platform SDK: Device I/O.

Probably the best bet is, this book and these websites:

"USB Complete" Jan Axelson, Lakeview Research, http://www.lvr.com ,

and http://www.usb.org/phpbb
Marco
________________________
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics

"ladal" <la***@hotmail.fr> wrote in message
news:13**************************@posting.google.c om...
Hi

I just want to know how do I detect an usb drive when it's plug and
retrieve his name, in vb.net

Nov 21 '05 #3

P: n/a
"Marc Reinig" <Ma***@newsgroups.nospam> wrote in message news:<ec**************@TK2MSFTNGP10.phx.gbl>...
Monitor WM_DEVICECHANGE messages and watch for the DBT_DEVICEARRIVAL and
DBT_DEVICEREMOVECOMPLETE messages pertaining to your device. Also look at
RegisterDeviceNotification.

Also, check RegisterDeviceNotification in the Platform SDK: Device I/O.

Probably the best bet is, this book and these websites:

"USB Complete" Jan Axelson, Lakeview Research, http://www.lvr.com ,

and http://www.usb.org/phpbb
Marco
________________________
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics

"ladal" <la***@hotmail.fr> wrote in message
news:13**************************@posting.google.c om...
Hi

I just want to know how do I detect an usb drive when it's plug and
retrieve his name, in vb.net

Hi

Thanx for your replies.
But can u give me some code sample in vb.net ?

Ladal
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.