Solved

How to detect a mini Device storage (128kb)from inside of mi application?

Posted on 2004-08-16
4
200 Views
Last Modified: 2013-11-15
Hello I have those mini device storages 128kb and I need  to detect automatically from inside of my aplication and import data from it. Right now I use the drivelistbox to detect what letter, but my problem is when somebody don't know what letter is the mini device storage they try to select the others drives list in this combo drivelistbox but giving this as an error which I don't know how to filter that error.
Could somebody tell me how to detect this mini device storage automatically?
Thanks a lot
Daniel
0
Comment
Question by:danielmingolla
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11807880
Try this (need reference to Microsoft Scripting Runtime)

Dim oFSO        As Scripting.FileSystemObject
Dim oDrive      As Scripting.Drive
Dim sType       As String
Dim sMsg        As String
   
    Set oFSO = New Scripting.FileSystemObject
   
    For Each oDrive In oFSO.Drives
        Select Case oDrive.DriveType
            Case 0: sType = "Unknown"
            Case 1: sType = "Removable"
            Case 2: sType = "Fixed"
            Case 3: sType = "Network"
            Case 4: sType = "CD-ROM"
            Case 5: sType = "RAM Disk"
        End Select

       
        sMsg = "Drive " & oDrive.DriveLetter & ": - " & sType
        If oDrive.IsReady Then
            sMsg = sMsg & " - Drive is Ready."
        Else
            sMsg = sMsg & " - Drive is not Ready."
        End If
       
        Debug.Print sMsg

    Next
   
    Set oFSO = Nothing

Drive should be ready, and it's type should be Removable. Also you should check oDrive.TotalSize. HTH
0
 

Author Comment

by:danielmingolla
ID: 11812748
Hello and thanks for your answer!!
Your sample looks like if what I need but is not working is not doing nothing I put all your code in a form in the load event and referenced to microsoft scripting but is not doing nothing neither the msgbox appear, could you please let me know what I am doing wrong!!
Thanks again
Daniel
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11812928
Private Sub Form_Load()
Dim oFSO        As Scripting.FileSystemObject
Dim oDrive      As Scripting.Drive
Dim sType       As String
Dim sMsg        As String
   
    Set oFSO = New Scripting.FileSystemObject
   
    For Each oDrive In oFSO.Drives
       
        If oDrive.IsReady Then
            If oDrive.DriveType = Removable And oDrive.TotalSize = 64274432 Then
                MsgBox oDrive.DriveLetter
            End If
        End If
       
    Next
   
    Set oFSO = Nothing
End Sub

64274432 is size of my USB flash device (64 MB). Replace this with size you need (128 MB = 64274432*2)
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 125 total points
ID: 11812946
Private Sub Form_Load()
Dim oFSO        As Scripting.FileSystemObject
Dim oDrive      As Scripting.Drive
Dim sType       As String
Dim sMsg        As String
Dim bFound      As Boolean
   
    Set oFSO = New Scripting.FileSystemObject
   
    For Each oDrive In oFSO.Drives
       
        If oDrive.IsReady Then
            If oDrive.DriveType = Removable And oDrive.TotalSize = 64274432 * 2 Then
                MsgBox oDrive.DriveLetter
                bFound = True
            End If
        End If
    Next
   
    If Not bFound Then MsgBox "Device can not be found"
   
    Set oFSO = Nothing
End Sub
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question