473,785 Members | 3,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET - Detecting the attachment of removable storage?

Max
Not sure exactly how to describe this or if it's even possible, so I'll
do my best and would appreciate some suggestions.

I'm currently working on a service that will allow me to automate some
file and folder manipulations. While this question is not concerning the
primary purpose of the program, I think it would be a nice addition.
What I'd like to be able to do is have the service be able to "detect"
whenever the user attaches some mass storage device (flash drive, usb
hard drives, mp3 players that don't need any soft, some media in card
readers like CF or SD, etc.) and be able to identify it, like by a
serial number or something. Would this be possible through some API
maybe? It's only for Win2k, XP, and 2k3, and all of those all do these
operations very easily and quickly, just a little pop-up from sys tray
to let you know that the device has been identified. How could I monitor
those events, find some information about the device that would separate
it from all others, and then get the drive letter that windows gave it?

Might be a rather complex problem, but like I've said, don't know much
about or how to even begin. If you have any ideas, please let me know.
Thanks.
Nov 20 '05 #1
3 5710
Hi,

Create a windows hook to look for the WM_DEVICECHANGE message.
http://msdn.microsoft.com/msdnmag/is...0/CuttingEdge/
http://www.dotnet247.com/247referenc...43/217435.aspx

Ken
--------------------
"Max" <ma*****@yahoo. com> wrote in message
news:OY******** ************@co mcast.com...
Not sure exactly how to describe this or if it's even possible, so I'll do
my best and would appreciate some suggestions.

I'm currently working on a service that will allow me to automate some
file and folder manipulations. While this question is not concerning the
primary purpose of the program, I think it would be a nice addition. What
I'd like to be able to do is have the service be able to "detect" whenever
the user attaches some mass storage device (flash drive, usb hard drives,
mp3 players that don't need any soft, some media in card readers like CF
or SD, etc.) and be able to identify it, like by a serial number or
something. Would this be possible through some API maybe? It's only for
Win2k, XP, and 2k3, and all of those all do these operations very easily
and quickly, just a little pop-up from sys tray to let you know that the
device has been identified. How could I monitor those events, find some
information about the device that would separate it from all others, and
then get the drive letter that windows gave it?

Might be a rather complex problem, but like I've said, don't know much
about or how to even begin. If you have any ideas, please let me know.
Thanks.

Nov 20 '05 #2
Hi Max,

I do not know how far it is possible, however I think you would have a look
first to this management class before you start with API's

http://msdn.microsoft.com/library/de...management.asp

I hope this helps?

Cor
Nov 20 '05 #3
Max
Would you by any chance have some VB code examples? I did a little bit
of looking around, but most of what I found was in C++ and still nothing
that gets me any closer.

Ken Tucker [MVP] wrote:
Hi,

Create a windows hook to look for the WM_DEVICECHANGE message.
http://msdn.microsoft.com/msdnmag/is...0/CuttingEdge/
http://www.dotnet247.com/247referenc...43/217435.aspx

Ken
--------------------
"Max" <ma*****@yahoo. com> wrote in message
news:OY******* *************@c omcast.com...

Not sure exactly how to describe this or if it's even possible, so I'll do
my best and would appreciate some suggestions.

I'm currently working on a service that will allow me to automate some
file and folder manipulations. While this question is not concerning the
primary purpose of the program, I think it would be a nice addition. What
I'd like to be able to do is have the service be able to "detect" whenever
the user attaches some mass storage device (flash drive, usb hard drives,
mp3 players that don't need any soft, some media in card readers like CF
or SD, etc.) and be able to identify it, like by a serial number or
something. Would this be possible through some API maybe? It's only for
Win2k, XP, and 2k3, and all of those all do these operations very easily
and quickly, just a little pop-up from sys tray to let you know that the
device has been identified. How could I monitor those events, find some
information about the device that would separate it from all others, and
then get the drive letter that windows gave it?

Might be a rather complex problem, but like I've said, don't know much
about or how to even begin. If you have any ideas, please let me know.
Thanks.


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2602
by: Garet Cammer | last post by:
Hi Everyone, I am writing a program to perform backup operations using the VB scripting File System Object to copy to removable media storage devices. The backup operation works fine, but when we attempt to remove the backup device, we often get a "Delayed Write Failed" error message, indicating that data was cached and the copy was not actually finished before device removal. The problem now is how can we guarantee that all data is...
1
451
by: Cliff Liao | last post by:
Hi all, I am trying to install the .NET framework 1.1 runtime package on Windows 2000 SP4. While the installation starts well, I get the following message box during the installation process : Please insert the disk : Microsoft .NET Framework (English) : OK Cancel Pressing the OK button will check the floppy drive for a disk and
6
1755
by: Rob | last post by:
int *p; p = malloc(1); free(p); /* */ In the above code, how do I detect that variable p points to nothing?
0
2241
by: Ryan | last post by:
I'm writing a utility that needs to be aware of media (CD, DVD, Zip disk, usb stick, etc) insertions and removals. Which seems to be more of a problem than I original imagined. I can't use any auto-run features because this is actually running on Windows XP Embedded... so that's the first thing to be aware of. Using WM_DEVICECHANGE works about half the time...that is, it works when a DVD or CD is inserted, but it does not work for Zip...
1
2414
by: vishal | last post by:
I have a removable device attached to the pc. I want some code to detect that particular device. Can I achieve this thru vb.net? If yes just help me regarding this.. Regards vishal.
3
3893
by: Mike Joyce | last post by:
I am trying to write a portable script that will find removable media, such as compact flash, sd card, usb, etc. drive and then upload files from the media. I want this to be portable so that I can write and maintain one program for both Linux and Windows. Each platform uses different functions so even if I could find two platform dependent functions that would be fine. Basically, I would like to avoid checking fixed disks if possible. If...
7
2291
by: glenn | last post by:
Hi can anyone tell me how given a directory or file path, I can pythonically tell if that item is on 'removable media', or sometype of vfs, the label of the media (or volume) and perhaps any other details about the media itself? thanks Glenn
4
8714
by: yellowblueyellow | last post by:
Hey All, I am using the following line of code to pick all logical drives on the local machine: string drives = Directory.GetLogicalDrives(); using the above code I can get output in the form of C:\, D:\, E: \..etc
4
2908
by: Per Juul Larsen | last post by:
Hi my VB program must always start from a removable disk. In addition, on the removable media to be images of the type *. jpg *. tips. If not the two conditions are present, the programme will end with a message. How do I write this little control function in Visual Basic regards pjl
0
9643
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
9480
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
10315
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
9947
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
8968
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.