Results 1 to 3 of 3

Thread: Finding the Zip Drive in a world of floppies and CD-Roms and Chickens

  1. #1

    Thread Starter
    Addicted Member thedoc1's Avatar
    Join Date
    Jan 2002
    Location
    Scenic Tonawanda, NY
    Posts
    143

    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:
    1. Sub ShowDriveType(drvpath)
    2.     Dim fs, d, s, t
    3.     Set fs = CreateObject("Scripting.FileSystemObject")
    4.     Set d = fs.GetDrive(drvpath)
    5.     Select Case d.DriveType
    6.         Case 0: t = "Unknown"
    7.         Case 1: t = "Removable"
    8.         Case 2: t = "Fixed"
    9.         Case 3: t = "Network"
    10.         Case 4: t = "CD-ROM"
    11.         Case 5: t = "RAM Disk"
    12.     End Select
    13.     s = "Drive " & d.DriveLetter & ": - " & t
    14.     MsgBox s
    15. 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
    Thanks

    Doc

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    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.

  3. #3
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    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:
    1. 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
    2. Private Sub Form_Load()
    3.     'KPD-Team 1998
    4.     'URL: [url]http://www.allapi.net/[/url]
    5.     'E-Mail: [email][email protected][/email]
    6.     Dim Serial As Long, VName As String, FSName As String
    7.     'Create buffers
    8.     VName = String$(255, Chr$(0))
    9.     FSName = String$(255, Chr$(0))
    10.     'Get the volume information
    11.     GetVolumeInformation "A:\", VName, 255, Serial, 0, 0, FSName, 255
    12.     'Strip the extra chr$(0)'s
    13.     VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
    14.     FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
    15.     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
    16. End Sub
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width