473,597 Members | 2,699 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 13277
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
2293
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
2596
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
5283
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
13628
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
37185
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
4392
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
5582
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
2224
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
1721
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
7977
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
7894
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8276
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
8381
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...
0
8261
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6705
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
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
5437
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();...
1
2409
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

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.