469,889 Members | 1,416 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

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 5516
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********************@comcast.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********************@comcast.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Rob | last post: by
1 post views Thread by vishal | last post: by
7 posts views Thread by glenn | last post: by
4 posts views Thread by yellowblueyellow | last post: by
4 posts views Thread by Per Juul Larsen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.