Connecting Tech Pros Worldwide Forums | Help | Site Map

Accessing Pen drive through VB

Newbie
 
Join Date: Aug 2008
Posts: 4
#1: Aug 12 '08
Hi all,

I have a VB 6.0 application which needs to perform the following operations:

1.Should recognise when the the pen drive is inserted.
2.Should validate if this is a valid pen drive. i.e if the volume name of the drive is "XXXX" then the user should be allowed to access.
3.To access a file from the drive.
4.Make changes into this file and save back to the pen drive.

I need this urgently but not able to find the required details..
Kindly help

Regards

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#2: Aug 12 '08

re: Accessing Pen drive through VB


kindly post what you have tried so far.
Newbie
 
Join Date: Aug 2008
Posts: 4
#3: Aug 13 '08

re: Accessing Pen drive through VB


Hi

I am able to get the volume name with the following code.

Dim fs, d, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName ("F:")))
s = "Drive " & d.DriveLetter & ": - " & d.VolumeName
MsgBox s

But the problem is
In GetAbsolutePathName("F:") i have to specify the drive path.But i want the application to get the path of the removable drive and the use it there.

What is the code to get the path of the removable drive

Thanks.
Reply