472,334 Members | 2,347 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Similar topics

0
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...
1
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...
6
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
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...
1
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...
3
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...
7
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...
4
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();...
4
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.