473,433 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,433 software developers and data experts.

Detect usb drive and his name

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
3 13250
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard H. Rowson | last post by:
Does anyone know of a way to detect which drive is a Zip drive (I guess in the same way that the various system variables can be queried) ?>Thanks
3
by: M | last post by:
I searched the FAQ for this NG and found no answers to my question... I'm writing an application in Java (I'm not a C programmer), however I need to be able to detect WHICH drive (d:\, e:\...
6
by: Kiran | last post by:
Hi, I have program, which opens file at the startup and logs error messages to the file, file handle is closed at the end of the program. However if file is deleted in-between, program do not...
8
by: Hayato Iriumi | last post by:
Hello, I'm trying to find a way to detect whether CD-ROM was inserted into the CD-ROM drive using C#. Does anyone have any idea how to do this? WMI? Win32 API? TIA
9
by: Paul Steele | last post by:
I am writing a C# app that needs to periodically poll for cdroms and usb storage device insertions. I've looked at the WMI functions but haven't found anything all that useful. The closest is...
16
by: google | last post by:
Hello, I am working on an Acc2003 app for my company. In the interest of reducing chances of corruption due to unstable network connectivity, I would like to either prevent users from running it...
1
by: Steve Marshall | last post by:
Hi All, Apologies if this has come up before, but how can I set up something that will notify me when a removeable drive (like a USB drive or CompactFlash card) is inserted into its slot? ...
1
by: poornimaniranjan | last post by:
Hello... I am new to VC++ environment..I am able to detect the CD-ROM drive using GetDriveType API . but this information is not enough for me. I need to know whether the drive is writer or...
0
by: D2 | last post by:
Hi, I'm working on a C# windows service that should detect when a USB drive is plugged in. After drive letter has been assigned, start using that drive. On the other side, when user clicks on...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.