USB flash memory stick auto detection

icarus1

Member
Joined
Feb 5, 2010
Messages
11
Location
Thessaloniki
Programming Experience
Beginner
Hi there,

My whole project consists of:
1. an electronic product
2. a memory stick (USB mass storage device) and
3. CD thast includes the Windows user interface program

The electronic product acts as a host controller that write data to a file (.wcs), which is in the memory stick whenever the user plug it to the USB connector. After this the user disconnect the memory stick from the electronic product and plug it to a PC that run the user interface program. Untill now the user searches for the .wcs file manually using an OpenFileDialog.

My question is:
Is it possible for the program to automatic detect almost plaged or new plaged USB flash memory sticks in order to load open the needed .wcs file? If this is possible then how can I do it?

Any other ideas that could make my product more sofisticated are welcome.


Thank in advance for your help.

Michael.
 
See post 2 http://www.vbdotnetforums.com/vb-ne...8-there-good-way-call-function-cd-change.html
Then the best approach would probably be to get the corresponding DriveInfo Class (System.IO) and check DriveType, it could be for example CDRom or Removable, perhaps also the VolumeLabel could help identify it. Once found a drive of interest you can search for files. It could be something like this:
VB.NET:
Dim drive As New IO.DriveInfo("F")
If drive.DriveType = IO.DriveType.Removable Then
    Dim files() As String = IO.Directory.GetFiles(drive.Name, "*.txt", IO.SearchOption.AllDirectories)

End If
 
Back
Top