|
-
Nov 20th, 2003, 04:33 PM
#1
Thread Starter
Addicted Member
Finding the Zip Drive in a world of floppies and CD-Roms and Chickens
Okay,
Here is the scoop.
I am working on a program makes a backup on a zip drive. I want to just specify the zip drive in the combo box.
Here is information from Microsoft.
VB Code:
Sub ShowDriveType(drvpath)
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(drvpath)
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
s = "Drive " & d.DriveLetter & ": - " & t
MsgBox s
End Sub
If I set the drive type to only allow type 2 - it would include the floppy and the zip drive.
How can I specify just the zip drive?
Thanks for your help
Doc
-
Nov 20th, 2003, 05:05 PM
#2
Two possible ideas:
If you can get the drive name from the system information, you could use that.
Or,
It is unlikely that a Zip drive would ever be assigned a drive letter of A: of B:, or that many systems these days have more that 2 floppy drives, so eliminating drives A: and B: might also work.
-
Nov 20th, 2003, 05:08 PM
#3
Fanatic Member
You may also try the GetVolumeInformation API. I don't have a ZIP drive here so I can't test it, but when I use the following code on a floppy drive it tells me the file system name is 'FAT'. Perhaps a ZIP drive uses another file system...?
VB Code:
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
Dim Serial As Long, VName As String, FSName As String
'Create buffers
VName = String$(255, Chr$(0))
FSName = String$(255, Chr$(0))
'Get the volume information
GetVolumeInformation "A:\", VName, 255, Serial, 0, 0, FSName, 255
'Strip the extra chr$(0)'s
VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
MsgBox "The Volume name of A:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" + Trim(Str$(Serial)) + "'", vbInformation + vbOKOnly, App.Title
End Sub
Author for Visual Basic Web Magazine
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|