473,804 Members | 3,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13320
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.goo gle.com...
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_DEVICEARRIV AL and
DBT_DEVICEREMOV ECOMPLETE messages pertaining to your device. Also look at
RegisterDeviceN otification.

Also, check RegisterDeviceN otification 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.goo gle.com...
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***@newsgrou ps.nospam> wrote in message news:<ec******* *******@TK2MSFT NGP10.phx.gbl>. ..
Monitor WM_DEVICECHANGE messages and watch for the DBT_DEVICEARRIV AL and
DBT_DEVICEREMOV ECOMPLETE messages pertaining to your device. Also look at
RegisterDeviceN otification.

Also, check RegisterDeviceN otification 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.goo gle.com...
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
2307
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
2607
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:\ etc...) on a win2k machine the CDROM drive is on. I assume that C or C++ can do this. The C/C++ code will then be wrapped in a JNI layer to be used by the java code. Basically, all I want the C code to do is return a letter corresponding to the...
6
5310
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 report any error while writing to the open file handle. On Windows, file shows-up again in explorer and automatically deleted finally when program ends. On Unix, same thing happens if file is on nfs mounted drive, but in this case, actual file is...
8
13649
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
37212
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 Win32_DiskDrive, but it doesn't seem to return any information on cdrom devices. I suspect there might be a Win32 API call, but I haven't found any info yet using Google. Is there a way to achieve this in C#?
16
4410
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 through a wireless connection, or limit their use to read-only. I have absolutely no idea if this is possible, and if so, how. Is there any way from within Access to get the list of routers they are connecting through? Ideally, I'd like to keep...
1
5598
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? Ideally I would like some sort of event that would call my code when it happens. The FileSystemWatcher object doesn't seem able to do this, unless I am missing something. Thanks
1
2234
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 reader. one more thing is i need to know whether CD is present in the drive or not please help me out Thanks poornima
0
1730
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 the eject button, stop using the drive so that windows can safely remove the hardware. Could someone let me know where to start? what libraries/namespaces can be used?
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10567
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.